Skip to content

[WIP] Making access token management thread-safe#379

Open
Niccari wants to merge 5 commits into
olucurious:developfrom
Niccari:fix/shared_token_management
Open

[WIP] Making access token management thread-safe#379
Niccari wants to merge 5 commits into
olucurious:developfrom
Niccari:fix/shared_token_management

Conversation

@Niccari
Copy link
Copy Markdown
Contributor

@Niccari Niccari commented Jul 30, 2025

Fixes: #378
Based: #377

To prevent inconsistencies in access token management, we have made it so that tokens are shared between threads.
Separated out the processes responsible for token management into TokenManager.

checks

  • All test has been passed.
  • linter, formatter reported no issues.

Niccari and others added 5 commits July 29, 2025 21:28
- changed _credentials, fcm_end_point to cached propety, for better type hint
- added non project_id unittest for BaseAPI
Without this fix, calling refresh_token_if_expired() on a 401/ACCESS_TOKEN_EXPIRED
response would clear _shared_token but not repopulate it, causing get_access_token()
on the subsequent retry to perform an unnecessary second credentials.refresh().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Niccari Niccari force-pushed the fix/shared_token_management branch from 8ea2901 to cf3f33b Compare May 17, 2026 07:27
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.

1 participant