-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print a CLI warning if user is already authenticated #11004
Comments
I'm pro-warning (You're already authenticated as foobar, are you sure you want to re-authenticate?) because there will be cases where you might want to auth as another user, or some such. Also |
@mafredri yes We still should keep |
) Prompt the user if they want to re-authenticate if they run `coder login` when already authenticated. Does not apply if they provided a token via flag or ENV variable. A new token should be generated an stored in that situation unless the `--use-token-as-session` flag was also used. fix(cli): prompt user on login attempt with invalid ENV token Fixes issue where if invalid token was set as ENV variable a user would be unable to login until the ENV variable was cleared. User will now be informed that the token is invalid and prompted to login normally.
Adds `coder auth` command with 3 sub-commands: `coder auth token`, `coder auth status` and `coder auth login`. `coder auth login`: This is the same command as `coder login`. `coder auth status`: Informs the user about their authentication status. It may make sense for this to not show an error if called when user is not logged in. `coder auth token`: Informs the user of their token string and the expiration time of the token. All the commands use a middleware to check that the user is authenticated and will return an error if the user is not. They also make at most 2 API calls. The commands have additional values that could be shown but are not with this implementation.
Currently, the CLI lets you log in as many times as you wish even though you're already logged in.
I think the CLI shouldn't let you do that or at least tell you that you're already logged in as a "warning".
Something like, "your Coder CLI is already authenticated as phorcys @ https://coder.domain.tld".
This occurs to me whenever I go back to use coder on a machine I don't use frequently, I never know if I'm logged in or not.
I think there could also be a
coder whoami
command letting you know what user you're connected with, on what instance and how long your authentication will be valid.I would like this because I go between my own instance and the dogfood instance, that feature would be pretty handy.
Coder v2.4.0+d19a762
cc: @matifali
The text was updated successfully, but these errors were encountered: