Skip to content

feat: Allow registration of a token refresh notification hook - #223

Merged
piitaya merged 5 commits into
cdnninja:masterfrom
pantsman0:master
Sep 1, 2026
Merged

piitaya merged 5 commits into
cdnninja:masterfrom
pantsman0:master

Conversation

@pantsman0

Copy link
Copy Markdown
Contributor

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.

@pantsman0 pantsman0 changed the title Allow registration of a token refresh notification hook feat: Allow registration of a token refresh notification hook Aug 26, 2026
…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 piitaya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@pantsman0

Copy link
Copy Markdown
Contributor Author

Hi @piitaya thanks for the review. The changes have been made as requested.

@piitaya

piitaya commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Thank you @pantsman0 !

@piitaya
piitaya merged commit 8701079 into cdnninja:master Sep 1, 2026
2 checks passed
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