Skip to content
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

If CODER_SESSION_TOKEN is set to some invalid token CLI can't login #9329

Closed
Tracked by #10759
matifali opened this issue Aug 25, 2023 · 2 comments
Closed
Tracked by #10759

If CODER_SESSION_TOKEN is set to some invalid token CLI can't login #9329

matifali opened this issue Aug 25, 2023 · 2 comments
Labels
bug Used to filter all bug issues s2 Broken use cases or features (with a workaround). Only humans may set this.

Comments

@matifali
Copy link
Member

matifali commented Aug 25, 2023

See

export CODER_SESSION_TOKEN=abcdefgh
coder login https://pr9327.test.cdr.dev
You are signed out or your session has expired. Please sign in again to continue.
Try logging in using 'coder login <url>'.                                        

Clearing the variable allows you to login fine,

coder@coder-coder-kube-7f64bf8f74-cjnsh:~$ CODER_SESSION_TOKEN=
coder@coder-coder-kube-7f64bf8f74-cjnsh:~$ coder login https://pr9327.test.cdr.dev
Open the following in your browser:

        https://pr9327.test.cdr.dev/cli-auth

> Paste your token here: 
> Welcome to Coder, coder! You're authenticated.
@matifali matifali added s2 Broken use cases or features (with a workaround). Only humans may set this. bug Used to filter all bug issues labels Aug 25, 2023
@matifali matifali changed the title If CODER_SESSION_TOKEN is set to soem invalid token CLi can't login If CODER_SESSION_TOKEN is set to some invalid token CLI can't login Aug 25, 2023
@github-actions github-actions bot added the stale This issue is like stale bread. label Feb 23, 2024
@matifali matifali removed the stale This issue is like stale bread. label Feb 24, 2024
elasticspoon added a commit to elasticspoon/coder that referenced this issue Apr 7, 2024
)

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.
@kylecarbs
Copy link
Member

I think this is a reasonable expectation. We can't unset environment variables for the user.

@kylecarbs kylecarbs closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
@matifali
Copy link
Member Author

@kylecarbs #12883 claims to fix this. Probably you should review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to filter all bug issues s2 Broken use cases or features (with a workaround). Only humans may set this.
Projects
None yet
Development

No branches or pull requests

2 participants