Gets or initializes the refresh token from memory or storage
Retrieves the current refresh token using a memory-first strategy:
Returns the in-memory token if available for maximum performance
Falls back to loading from persistent storage if not in memory
The refresh token is critical for obtaining new access tokens when
the current one expires, maintaining continuous authentication.
Returns null|string
The current refresh token or null if not available
Example
// Check if we have a refresh token before attempting token refresh constrefreshToken = getRefreshTokenState(); if (refreshToken) { // We can refresh the access token when needed scheduleTokenRefresh(3600); }
Source
exportfunctiongetRefreshTokenState(): string | null { if (currentRefreshToken) { returncurrentRefreshToken; }
// Try to load from persistent storage returnretrieveTokenValue<string>(REFRESH_TOKEN_KEY); }
Gets or initializes the refresh token from memory or storage
Retrieves the current refresh token using a memory-first strategy:
The refresh token is critical for obtaining new access tokens when the current one expires, maintaining continuous authentication.