feat: Allow registration of a token refresh notification hook - #223
Merged
Merged
Conversation
…resh token is updated.
…n. The access token should be kept for the client, but sending both returns structured data and exposing that access key shouldn't impede the operation of the client.
piitaya
reviewed
Aug 26, 2026
Collaborator
There was a problem hiding this comment.
Thank you for the PR.
Can you make the hook accept async? Everything else in the lib uses _maybe_await for that. And wrap the call in a try/except, otherwise a hook that raises breaks the token refresh.
Would be nice to call it in device_code_flow_complete() as well, it returns a refresh token too.
Contributor
Author
|
Hi @piitaya thanks for the review. The changes have been made as requested. |
piitaya
approved these changes
Sep 1, 2026
Collaborator
|
Thank you @pantsman0 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Authentication can be configured by providing a refresh token, but that token itself can be refreshed. This changes allows registration of a callback that is triggered when the authentication token is update and a refresh token is present.