• Retrieves the current Spotify access token

    Gets the currently stored access token for API requests. Dynamically imports the token module to avoid circular dependencies.

    This function:

    • Attempts to retrieve token from memory state first
    • Falls back to secure storage if not in memory
    • Rehydrates memory state from storage when needed
    • Returns null if no valid token exists
    • Handles all retrieval errors gracefully

    Returns Promise<null | string>

    Promise resolving to the access token or null if not authenticated

    // Get token for API request
    const token = await getAccessToken();
    if (token) {
    headers.Authorization = `Bearer ${token}`;
    await makeApiRequest("/me", headers);
    } else {
    // Handle unauthenticated state
    showLoginPrompt();
    }
    export async function getAccessToken(): Promise<string | null> {
    const mod = await import("./storage/token-operations");
    return mod.getAccessToken();
    }