Class GitHubStrategy<User>

Type Parameters

  • User

Hierarchy

Constructors

Properties

name: string = GitHubStrategyDefaultName
options: OAuth2StrategyOptions
sessionCodeVerifierKey: string
sessionStateKey: string
verify: StrategyVerifyCallback<User, OAuth2StrategyVerifyParams<GitHubProfile, GitHubExtraParams>>

Methods

  • The authentication flow of the strategy.

    This method receives the Request to authenticator and the session storage to use from the Authenticator. It may receive a custom callback.

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

    Parameters

    • request: Request
    • sessionStorage: SessionStorage<SessionData, SessionData>
    • options: AuthenticateOptions

    Returns Promise<User>

  • 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

  • Throw an AuthorizationError or a redirect to the failureRedirect.

    Parameters

    • message: string

      The error message to set in the session.

    • request: Request

      The request to get the cookie out of.

    • sessionStorage: SessionStorage<SessionData, SessionData>

      The session storage to retrieve the session from.

    • options: AuthenticateOptions

      The strategy options.

    • Optionalcause: Error

    Returns Promise<never>

    If the throwOnError is set to true.

    If the failureRedirect is set or throwOnError is false.

  • Get new tokens using a refresh token.

    Parameters

    • refreshToken: string

      The refresh token to use

    • Optionaloptions: Partial<Pick<OAuth2StrategyOptions, "scopes">> & {
          signal?: AbortSignal;
      }

      Optional options to override the default strategy options

    Returns Promise<Body & GitHubExtraParams>

    A promise that resolves to the new tokens

  • Parameters

    • token: string
    • Optionaloptions: {
          signal?: AbortSignal;
          tokenType?: "access_token" | "refresh_token";
      }
      • Optionalsignal?: AbortSignal
      • OptionaltokenType?: "access_token" | "refresh_token"

    Returns Promise<void>

  • Returns the user data or throw a redirect to the successRedirect.

    Parameters

    • user: User

      The user data to set in the session.

    • request: Request

      The request to get the cookie out of.

    • sessionStorage: SessionStorage<SessionData, SessionData>

      The session storage to retrieve the session from.

    • options: AuthenticateOptions

      The strategy options.

    Returns Promise<User>

    The user data.

    If the successRedirect is set, it will redirect to it.

  • Parameters

    • accessToken: string

    Returns Promise<{
        type?: string;
        value: string;
    }[]>