Optionaltoken: string | OAuthTokenOptionalstorage: TokenStorageClear token
Get access token (refreshes if expired)
Get refresh token
Get current token
Check if refresh token is available
Check if token is expired
Load token from storage
Refresh the access token
Set token.
If the incoming token does not include a refresh token but we already
have one stored, preserve the existing refresh token. This matches the
SW Combine OAuth2 contract: refresh tokens are only issued the first
time a user authorizes, and the refresh-token grant response also does
not include a new refresh token. Without this merge behavior, a second
handleCallback or auto-refresh would silently drop the refresh token
on the floor, leaving the client unable to recover from future 401s.
To explicitly clear the entire token (including the refresh token), use clear instead.
Check if token should be refreshed (expired or expiring soon)
Manages OAuth tokens including expiration and refresh