Class OidcTokenRefresherExperimental

Class responsible for refreshing OIDC access tokens

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

Constructors

  • Experimental

    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

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

  • Experimental

    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

    when token refresh fails

  • Experimental

    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

      • OptionalrefreshToken?: string

        OPTIONAL new refresh token

    Returns Promise<void>