feat(cli): add auth command (#11004) #12885
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11004 (partially)
Creates the command
coder auth
for authentication purposes.coder auth
has 3 sub-commandslogin
,status
andtoken
. Currently the sub-commands make 2 requests to the server: validation of the user and an additional command for sub-command info (token info, etc.)coder auth status
andcoder auth token
commands return an error if the user is not authenticated when they are called.coder auth
Just returns the help message.
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.
Additional info that is available from the current requests and could be shown:
coder auth token
Informs the user of their token string and the expiration time of the token. (Maybe
coder auth session
is a better name or alias?)Additional info that is available from the current requests and could be shown: