Class OidcTokenRefresherExperimental

Class responsible for refreshing OIDC access tokens

Client implementations will likely want to override persistTokens to persist tokens after successful refresh

Constructors

  • Parameters

    • issuer: string

      The OIDC issuer as returned by the /auth_issuer API

    • clientId: string

      id of this client as registered with the OP

    • redirectUri: string

      redirectUri as registered with OP

    • deviceId: string

      Device ID of current session

    • idTokenClaims: IdTokenClaims

      idTokenClaims as returned from authorization grant used to validate tokens

    Returns OidcTokenRefresher

Properties

idTokenClaims: IdTokenClaims

idTokenClaims as returned from authorization grant used to validate tokens

inflightRefreshRequest?: Promise<AccessTokens>
oidcClient: OidcClient
oidcClientReady: Promise<void>

Promise which will complete once the OidcClient has been initialised and is ready to start refreshing tokens.

Will reject if the client initialisation fails.

Methods

  • Attempt token refresh using given refresh token

    Parameters

    • refreshToken: string

      refresh token to use in request with token issuer

    Returns Promise<AccessTokens>

    tokens - Promise that resolves with new access and refresh tokens

    Throws

    when token refresh fails

  • Persist the new tokens, called after tokens are successfully refreshed.

    This function is intended to be overriden by the consumer when persistence is necessary.

    Parameters

    • tokens: {
          accessToken: string;
          refreshToken?: string;
      }
      • accessToken: string

        new access token

      • Optional refreshToken?: string

        OPTIONAL new refresh token

    Returns Promise<void>

Generated using TypeDoc