-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix: oauth refresh not triggered on token expiry #3767
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,15 +214,12 @@ async def _exchange_credential( | |
| return credential, False | ||
|
|
||
| if isinstance(exchanger, ServiceAccountCredentialExchanger): | ||
| exchanged_credential = exchanger.exchange_credential( | ||
| self._auth_config.auth_scheme, credential | ||
| ) | ||
| else: | ||
| exchanged_credential = await exchanger.exchange( | ||
| credential, self._auth_config.auth_scheme | ||
| return ( | ||
| exchanger.exchange_credential(self._auth_config.auth_scheme, credential), | ||
| True | ||
| ) | ||
|
|
||
| return exchanged_credential, True | ||
| return await exchanger.exchange(credential, self._auth_config.auth_scheme) | ||
|
Comment on lines
216
to
+224
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this change correctly handles the different interfaces of credential exchangers, the For better long-term maintainability, consider refactoring
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agreed. There are currently two BaseCredentialExchanger's (A) (B), B should be deprecated, and as part of that process ServiceAccountCredentialExchanger should inherit from A instead of B, and be moved to |
||
|
|
||
| async def _refresh_credential( | ||
| self, credential: AuthCredential | ||
|
|
||
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.
For better readability, it's clearer to unpack the tuple returned by
exchanger.exchange. This makes the intent of the code more explicit.Uh oh!
There was an error while loading. Please reload this page.
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.
Agreed - addressed in 2dae391.