Class OAuth

OAuth 2.0 flows.

Hierarchy

  • BaseAuthAPI
    • OAuth

Constructors

Properties

clientAssertionSigningAlg?: string
clientAssertionSigningKey?: string
clientId: string
clientSecret?: string
configuration: Configuration
domain: string
idTokenValidator: IDTokenValidator
useMTLS?: boolean

Methods

  • Use this endpoint to invalidate a Refresh Token if it has been compromised.

    The behaviour of this endpoint depends on the state of the Refresh Token Revocation Deletes Grant toggle. If this toggle is enabled, then each revocation request invalidates not only the specific token, but all other tokens based on the same authorization grant. This means that all Refresh Tokens that have been issued for the same user, application, and audience will be revoked. If this toggle is disabled, then only the refresh token is revoked, while the grant is left intact.

    See: https://auth0.com/docs/api/authentication#revoke-refresh-token

    Example

    const auth0 = new AuthenticationApi({
    domain: 'my-domain.auth0.com',
    clientId: 'myClientId'
    clientSecret: 'myClientSecret'
    });

    await auth0.oauth.revokeRefreshToken({ token: 'myrefreshtoken' })

    Parameters

    Returns Promise<VoidApiResponse>

  • Exchanges a subject token (refresh token in this case) for an access token for the connection.

    The request body includes:

    • client_id (and client_secret/client_assertion via addClientAuthentication)
    • grant_type set to urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token
    • subject_token (refresh token) and fixed subject_token_type for refresh tokens (urn:ietf:params:oauth:token-type:refresh_token)
    • requested_token_type (http://auth0.com/oauth/token-type/federated-connection-access-token) indicating that a federated connection access token is desired
    • connection name and an optional login_hint if provided

    Throws

    An error if the exchange fails.

    Parameters

    Returns Promise<JSONApiResponse<TokenSet>>

    A promise with the token response data.