Skip to content
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

fix: return cached token from getValidIdToken #290

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

mfellner
Copy link
Contributor

@mfellner mfellner commented Dec 4, 2024

This change ensures getValidIdToken and getValidCustomToken actually return the refreshed token from the cache on subsequent calls to the function.

Without this change, getValidIdToken and and getValidCustomToken only return the fresh token immediately after refreshing. Otherwise the functions return the argument serverIdToken or serverCustomToken which is likely the original, expired token. This is because internally the expiry check happens against the cached, fresh token.

The caller of getValidIdToken and and getValidCustomToken is typically not able to update the value they pass as the "initial" token in memory. For example, because it comes from a call to getTokens that is only made on a full page reload.

Fixes #291

@awinogrodzki
Copy link
Owner

Hey @mfellner!

Thank you for the PR! I will change the target to canary branch and release it in upcoming canary version shortly.

@awinogrodzki awinogrodzki changed the base branch from main to canary December 16, 2024 10:18
@awinogrodzki awinogrodzki merged commit c4224fd into awinogrodzki:canary Dec 16, 2024
3 of 4 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.

getValidIdToken and getValidCustomToken return old server token on subsequent calls
2 participants