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

feat: Persistent tokens for login #182

Merged
merged 4 commits into from
Apr 25, 2023
Merged

feat: Persistent tokens for login #182

merged 4 commits into from
Apr 25, 2023

Conversation

drstrangelooker
Copy link
Collaborator

@drstrangelooker drstrangelooker commented Apr 25, 2023

$ gzr session help
Commands:
  gzr session help [COMMAND]  # Describe subcommands or one specific subcommand
  gzr session login           # Create a persistent session
  gzr session logout          # End a persistent session

Now you can use a command like gzr session login --host ... and Gazer will login and store the access token. Then you can run other commands like gzr COMMAND SUBCOMMAND --token_file --host ... and Gazer will use the existing token rather than logging in and out every time. The command gzr session logout --token_file --host ... can be used to manually log out the token. The token also expires after 1 hour.

Alternately, you can do the following, especially if you don't have write access for the token file.

TOKEN=$(gzr session login --text --host ...)
# This will store the token in the environment variable TOKEN
# The --text switch outputs the token to the screen instead of writing it to a file.
gzr COMMAND SUBCOMMAND --token $TOKEN --host ...
# The --token switch gets the token from the command line
gzr COMMAND SUBCOMMAND --token $TOKEN --host ...
gzr COMMAND SUBCOMMAND --token $TOKEN --host ...
gzr session logout --token $TOKEN --host ...

The persistent session token is of minor utility right now, but it will enable features in the future that require working with a session in developer mode.

@github-actions
Copy link
Contributor

Ruby-CI Tests

    4 files      4 suites   1m 31s ⏱️
136 tests 136 ✔️ 0 💤 0 ❌
544 runs  544 ✔️ 0 💤 0 ❌

Results for commit 1e0fbf6.

Copy link
Contributor

@jkaster jkaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants