Description
It would be nice to add the ability to authenticate to a provider through the Coder CLI or REST API. Going through the Coder Web UI sometimes confusing, especially for new users onboarding to the platform or are re-authenticating. I'm looking for something similar to how coder login
automatically opens the Coder /cli-auth
page, and from there I would either follow the login flow or be shown that I'm already authenticated.
When you're authenticating with an External Auth provider, it already does this to some extent where it'll automatically open /external-auth/<provider-id>
, then redirect me to the external provider's login page. The CLI could be something like coder external-auth login <provider-id>
.
UPDATE: found this by accident, but it looks like this does already happen within a workspace. Didn't catch this until I unlinked my external auth and noticed the env vars GIT_ASKPASS
and GIT_SSH_COMMANDS
referenced the Coder CLI:
coder@coder-d581e5e7-5181-49ab-9ec5-98c9d66cf057-589d47c458-glfzc:~$ env | grep "GIT"
GIT_SSH_COMMAND=/tmp/coder.snW6A0/coder gitssh --
GIT_ASKPASS=/tmp/coder.snW6A0/coder
coder@coder-d581e5e7-5181-49ab-9ec5-98c9d66cf057-589d47c458-glfzc:~$ git clone https://github.com/****/coder-templates.git
Cloning into 'coder-templates'...
Open the following URL to authenticate with Git:
https://coder.*****.****/external-auth/github
Is it possible to do this outside of a workspace for a specific provider?