SW Combine SDK
    Preparing search index...

    Manages OAuth tokens including expiration and refresh

    Index

    Constructors

    Methods

    • Get access token (refreshes if expired)

      Returns Promise<string | null>

    • 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.

      Parameters

      Returns void

    • Check if token should be refreshed (expired or expiring soon)

      Returns boolean