fix: warn when token lifetime is shorter than expiryBuffer#70
Merged
Conversation
When the token endpoint returns an expires_in shorter than the configured expiryBuffer (default 30s), the token is immediately treated as expired, causing infinite refresh loops. This adds a console.warn at token receipt (both init and refresh paths) so developers can diagnose the misconfiguration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
console.warnwhen the token endpoint returnsexpires_inshorter than the configuredexpiryBuffer(default 30s)Context
Investigated how other OIDC libraries handle this (oidc-client-ts, MSAL.js, AppAuth-JS, angular-oauth2-oidc). None of them solve this properly — most just assume tokens live much longer than the buffer. Rather than adding complex capping logic that either breaks proactive refresh or changes function signatures across all adapters, a runtime warning is the pragmatic fix. All framework adapters (React, Vue, Angular, Svelte, etc.) go through
OidcClient, so a single warning covers everything.Test plan
pnpm --filter oidc-js-core testpassespnpm --filter oidc-js buildsucceeds🤖 Generated with Claude Code