fix(cli): fix coder login token failing without --url flag#22742
Conversation
f4f3c30 to
fbbb46d
Compare
1d1b3dd to
13eef14
Compare
`coder login token` didn't load the server URL from config, so it always required --url or CODER_URL when using the keyring. This command would only print out the token when already logged in to a deployment and file storage is used to store the session token (keyring is the default on Windows/macOS). It would also print out an incorrect token when --url was specified and the session token stored on disk was for a different deployment that the user logged into. Also error when using the file backend with a --url that doesn't match the stored config URL, since the file backend only stores one token and would silently return the wrong one.
13eef14 to
bfb24f3
Compare
|
@EhabY does this affect VS code extension? Do you think we should back port this to 2.31 release? |
|
We always pass the URL, so this should not affect the VS Code extension (once released on stable) For reference, we call
@zedkipp Is this only for the global |
|
@matifali @EhabY this should have no impact to the extension since it only closes up a few holes and unifies behavior when the keyring or a file is used to store the session token. The |
Ah thanks, all good from the VS Code side then! |
Previously
coder login tokendidn't load the server URL from config, so it always required --url or CODER_URL when using the keyring to store the session token. This command would only print out the token when already logged in to a deployment and file storage is used to store the session token (keyring is the default on Windows/macOS). It would also print out an incorrect token when --url was specified and the session token stored on disk was for a different deployment that the user logged into.This change fixes all of these issues, and also errors out when using session token file storage with a
--urlargument that doesn't match the stored config URL, since the file only stores one token and would silently return the wrong one.See #22733 for a table of the before/after behaviors.