oidc-caep-client
    Preparing search index...

    Class TokenManager

    Caches TokenSets per key (typically a user session id) and keeps them fresh.

    • getAccessToken(key) always returns a token valid for at least refreshSkewSec, refreshing on demand.
    • With autoRefresh (default), a timer refreshes each token refreshSkewSec before it expires.
    • Concurrent refreshes for the same key are coalesced into one token-endpoint call; across tabs sharing a store, a refresh holds a Web Lock and reuses the tokens another tab has just obtained, so a rotating refresh token is never presented twice.
    • set(key, ts, { schedule: false }) / unschedule(key) keep a key's tokens without refreshing them.

    Events: "refreshed" (key, tokenSet) — new tokens obtained via refresh_token "refresh_error" (key, error) — refresh failed (tokens are dropped if the grant is invalid) "expired" (key) — tokens for key could not be renewed and were removed "removed" (key) — tokens deleted via delete()

    Hierarchy (View Summary)

    Index
    • Returns a usable access token for key, refreshing first if it is expired or about to expire.

      Parameters

      • key: string
      • Optionalopts: { forceRefresh?: boolean }

      Returns Promise<string>

    • Returns the cached TokenSet for key, refreshing first if the access token is (nearly) expired. Use this rather than getAccessToken() when the token may be DPoP-bound: the caller needs its token_type to build the right Authorization header (OIDCClient.resourceHeaders()).

      Parameters

      • key: string
      • Optionalopts: { forceRefresh?: boolean } = {}

      Returns Promise<TokenSet>