• Gets or initializes the refresh token from memory or storage

    Retrieves the current refresh token using a memory-first strategy:

    1. Returns the in-memory token if available for maximum performance
    2. 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

    // Check if we have a refresh token before attempting token refresh
    const refreshToken = getRefreshTokenState();
    if (refreshToken) {
    // We can refresh the access token when needed
    scheduleTokenRefresh(3600);
    }
    export function getRefreshTokenState(): string | null {
    if (currentRefreshToken) {
    return currentRefreshToken;
    }

    // Try to load from persistent storage
    return retrieveTokenValue<string>(REFRESH_TOKEN_KEY);
    }