Class OpenAuthStrategy<U>

Type Parameters

  • U

Hierarchy

Constructors

Properties

client: Client
name: string = "openauth"

The name of the strategy. This will be used by the Authenticator to identify and retrieve the strategy.

verify: VerifyFunction<U, VerifyOptions>

Methods

  • The authentication flow of the strategy.

    This method receives the Request from the authenticator we want to authenticate.

    At the end of the flow, it will return a the User data to be used by the application.

    Parameters

    Returns Promise<U>

  • Return extra parameters to be included in the authorization request.

    Some OAuth 2.0 providers allow additional, non-standard parameters to be included when requesting authorization. Since these parameters are not standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication strategies can override this function in order to populate these parameters as required by the provider.

    Parameters

    Returns URLSearchParams

  • Returns Promise<{ state: string; url: URL; verifier?: string }>

  • Refreshes the access token using the provided refresh token.

    Parameters

    • refresh: string

      The refresh token to use for obtaining a new access token.

    • Optionalaccess: string

      An optional access token to validate if it needs to be refreshed.

    Returns Promise<undefined | Tokens>

    The new tokens obtained after refreshing.

  • Parameters

    • code: string
    • codeVerifier: string

    Returns Promise<ExchangeSuccess | ExchangeError>

  • Type Parameters

    • T extends SubjectSchema

    Parameters

    • schema: T
    • token: string
    • Optionaloptions: { audience?: string; refresh: string }

    Returns Promise<
        {
            aud: string;
            subject: {
                [type in string
                | number
                | symbol]: { properties: InferOutput<T[type]>; type: type }
            }[keyof T];
            tokens?: Tokens;
        },
    >