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

Improve coder cli re-login experience when api token is expired #10925

Closed
Tracked by #10759
mattlqx opened this issue Nov 28, 2023 · 2 comments · Fixed by #12466
Closed
Tracked by #10759

Improve coder cli re-login experience when api token is expired #10925

mattlqx opened this issue Nov 28, 2023 · 2 comments · Fixed by #12466
Labels
feature Something we don't have yet good first issue Issues suitable for starters and community contributors

Comments

@mattlqx
Copy link

mattlqx commented Nov 28, 2023

We have a user that received this when trying to ssh to their workspace:

check entitlement warnings error: get user me: GET https://coder/api/v2/users/me: unexpected status code 401: You are signed out or your session has expired. Please sign in again to continue.: Try logging in using 'coder login <url>'.
        Error: API key expired at "2023-11-24 20:13:30.881157 +0000 UTC".
You are signed out or your session has expired. Please sign in again to continue.
Try logging in using 'coder login <url>'.
kex_exchange_identification: Connection closed by remote host

Since they see a URL from the unsuccessful API call, it's tempting to click that but it won't solve their problem. For re-logging in, instead of <url> in the message, would it be possible to display the URL there so it's a simple copy and paste operation?

Could the URL be optional so that coder login will just re-login to the same server?

@cdr-bot cdr-bot bot added the feature Something we don't have yet label Nov 28, 2023
@mattlqx mattlqx changed the title Give login URL in message when session token expired Improve coder cli re-login experience when api token is expired Nov 28, 2023
@matifali
Copy link
Collaborator

matifali commented Nov 29, 2023

Could the URL be optional so that coder login will just re-login to the same server?

This has been previously requested in a discord discussion

if url file exists ~/config/coderv2/url then coder login should be enought

@coder/pms I suggest we do this.

@matifali matifali added the good first issue Issues suitable for starters and community contributors label Nov 29, 2023
@mafredri
Copy link
Member

mafredri commented Dec 1, 2023

For illustrative purposes, I'm adding a screenshot to show how jarring this issue really is:

image

User won't know what hit them. I would like to see the following changes:

  1. Entitlement error never shows up unless it's the primary error
  2. Same for GET:https://big.cdr.dev/api/v2/workspaces?q=owner%3Ame & co.
  3. Expiry date doesn't seem all that important? We could skip it (maybe show in verbose mode)
  4. As suggested, allow coder login to log into existing deployment, but update output to show "Authenticating with https://dev.coder.com..." or something similar.

Right now, we seem to be lacking a lot in CLI validation. This kind of error should definitely not be shown when typing coder login:

image

elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 7, 2024
elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 7, 2024
Allow `coder login` to log into existing deployment if available.

Output to indicate saved URL was used.

Update help and error messages to indicate that `coder login` is
available as a command.
elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 8, 2024
Allow `coder login` to log into existing deployment if available.

Output to indicate saved URL was used.

Update help and error messages to indicate that `coder login` is
available as a command.
elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 8, 2024
Allow `coder login` to log into existing deployment if available.

Output to indicate saved URL was used.

Update help and error messages to indicate that `coder login` is
available as a command.
elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 8, 2024
Allow `coder login` to log into existing deployment if available.

Output to indicate saved URL was used.

Update help and error messages to indicate that `coder login` is
available as a command.
elasticspoon added a commit to elasticspoon/coder that referenced this issue Mar 8, 2024
Allow `coder login` to log into existing deployment if available.

Output to indicate saved URL was used.

Update help and error messages to indicate that `coder login` is
available as a command.
mafredri pushed a commit that referenced this issue Mar 11, 2024
Allow `coder login` to log into existing deployment if available.

Update help and error messages to indicate that `coder login` is
available as a command.

Fixes #10925
Fixes #9551
mtojek pushed a commit that referenced this issue Mar 11, 2024
Allow `coder login` to log into existing deployment if available.

Update help and error messages to indicate that `coder login` is
available as a command.

Fixes #10925
Fixes #9551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something we don't have yet good first issue Issues suitable for starters and community contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants