-
Notifications
You must be signed in to change notification settings - Fork 70
feat(oauth): Use keyring to store oauth token #1228
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
base: wb/add-oauth-refresh-token
Are you sure you want to change the base?
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
cmd/src/login.go
Outdated
| noToken := cfg.AccessToken == "" | ||
| endpointConflict := endpointArg != cfg.Endpoint | ||
|
|
||
| secretStore, err := keyring.Open() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only open this if doing deviceflow. If we are not doing deviceflow don't open secret storage. IE avoid interacting with secret storage unless we actually need to.
Maybe you can add a wrapper around secretstore which lazily opens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop looking over my shoulder :P busy addressing this atm 😄
2f24f44 to
7f2c665
Compare
278fc77 to
6f58c79
Compare
- rename keyring to store - make keyring struct src-cli and set label on secret
- Token converts expiresIn to a timestamp - Store the token with the endpoint suffix
- Add secret store that supports different backends - We use a registry map for a few secrets and the registry gets persisted as one secret to the keyring. We don't waant to create a keyring secret for every different secret - Store is opened once to load the registry.
7f2c665 to
87b5732
Compare
6f58c79 to
5a355f7
Compare
use keyring to store oauth token
add internal/keyring package to use 99designs keyring
return Token struct
store token in keyring
create token struct from TokenResponse
add basic http transport for oauth
OAuth transport and use when available in api client
Test plan