Skip to content

Implement Token Expiration Handling and Auto-Refresh - #18

Merged
neil-pack merged 4 commits into
masterfrom
feature-enhancement
Aug 21, 2026
Merged

neil-pack merged 4 commits into
masterfrom
feature-enhancement

Conversation

@neil-pack

Copy link
Copy Markdown
Contributor

SDK tracks token expiration time from OAuth response (expires_in)

Detects when token is within configurable threshold of expiration (default 5 minutes)

Public method isTokenExpired() returns true/false

Public method getTokenExpirationTime() returns Unix timestamp

Configuration option onAuthenticationFailure accepts callable/callback

Callback receives response object and failure reason ('expired' vs 'invalid')

Optional request replay after token refresh via callback

Enhanced getAccessToken() returns array with token and expiration info

New setAccessToken($token, $expiresIn) method with expiration tracking

All changes are backward compatible (existing code continues to work)

Tests cover all expiration scenarios

Documentation explains all three approaches with examples

@neil-pack
neil-pack merged commit d9b557c into master Aug 21, 2026
2 checks passed
@neil-pack
neil-pack deleted the feature-enhancement branch August 21, 2026 17: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