-
Notifications
You must be signed in to change notification settings - Fork 45
Adds token refresh logic #162
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
Conversation
|
pkg/sandbox/auth/auth.go
Outdated
| if !tok.Valid() { | ||
| return nil, false | ||
| } | ||
| return tok, true |
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.
no needed
pkg/sandbox/auth/auth.go
Outdated
| func (c *Client) RefreshSession() *session.Token { | ||
| panic("refresh session not implemented") | ||
| func (c *Client) refresh(tok *session.Token) *session.Token { | ||
| ctx := context.Background() |
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.
nit, pass it in.
| return tok | ||
| } | ||
|
|
||
| if newToken.AccessToken != tok.AccessToken { |
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.
Is this check needed?
pkg/sandbox/auth/auth.go
Outdated
| return nil | ||
| } | ||
|
|
||
| // TODO: figure out how to share oidc provider and outh2 client |
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.
typo: outh2
|
I tested by:
|
Summary
Adds token refresh logic
How was it tested?
I'm actually unsure how best to test this other than going through the auth flow, waiting for my token to expire, and running again. Any ideas on how best to shortcut that process? Is there a way to purposefully give myself an expired token on the first try?