nextspace
    Preparing search index...

    Function ensureFreshToken

    • Ensures that the current access token is valid.

      If the token is still fresh (more than 2 minutes until expiry) the current access token is returned immediately. If it is expired or within the buffer window a refresh is triggered first.

      Concurrent callers are automatically deduplicated by TokenManager.

      Returns Promise<string | null>

      The current valid access token, or null if refresh failed.