Documentation
    Preparing search index...

    Authentication adapter for GitHub OAuth 2.0 Web Application Flow. Handles profiles, repository existence checks, and repository creation.

    Hierarchy

    • AbstractOAuthAdapter
      • GithubAuthAdapter
    Index

    Constructors

    • Parameters

      • Optionalparams: AuthParameters

      Returns GithubAuthAdapter

    Properties

    _alias: string
    _authorizationEndpoint: string = 'https://github.com/login/oauth/authorize'
    _params: AuthParameters
    _tokenEndpoint: string = 'https://github.com/login/oauth/access_token'
    _userProfileEndpoint: string = 'https://api.github.com/user'
    UserClass: typeof User

    The User class reference to be used by the adapter.

    Accessors

    • get alias(): string

      Returns string

    • set alias(alias: string): void

      Parameters

      • alias: string

      Returns void

    Methods

    • Custom GitHub API call to check repository existence.

      Parameters

      • accessToken: string
      • owner: string
      • name: string

      Returns Promise<boolean>

    • Custom GitHub API call to create a repository.

      Parameters

      • accessToken: string
      • name: string
      • options: { autoInit?: boolean; description?: string; private?: boolean } = {}

      Returns Promise<any>

    • Deletes a user account from the auth store.

      Parameters

      • user: User

        Target user entity.

      Returns Promise<any>

      Promise resolving to true.

    • Exchanges the temporary authorization code for an access token packet.

      Parameters

      • code: string

        The temporary auth code.

      • OptionalredirectUri: string

        Optional redirect URL context.

      Returns Promise<any>

      Access token payload.

    • Returns the authorization redirect URL.

      Parameters

      • OptionalredirectUri: string

        The callback URL.

      • Optionalscopes: string[]

        The requested authorization scopes.

      • Optionalstate: string

        The state parameters for CSRF protection.

      Returns string

      The generated authorization URL.

    • Returns user details from GitHub by validating the access token.

      Parameters

      • accessToken: string

      Returns Promise<any>

    • Returns the pluggable API routes builder.

      Returns any

    • Retrieves a configuration parameter.

      Parameters

      • key: AuthParametersKeys

        The parameter key to fetch.

      Returns any

      The corresponding configuration value.

    • Express middleware capturing Bearer JWT tokens to execute auth verification.

      Returns ApiMiddleware

      The middleware function.

    • Initiates password recovery/reset process for a user.

      Parameters

      • email: string

        The user email.

      • OptionalredirectTo: string

        Optional redirect destination.

      Returns Promise<any>

    • Refreshes an expired access token using a refresh token string.

      Parameters

      • refreshToken: string

        Target refresh token.

      Returns Promise<any>

      Throws an error if refresh token logic is not implemented by the provider.

    • Registers a new user account (unsupported for OAuth adapters).

      Parameters

      • user: User

        Target user entity.

      • OptionalclearPassword: string

        Optional cleartext password.

      Returns Promise<any>

      Throws an error indicating registration is unsupported.

    • Revokes the access token (noop default).

      Parameters

      • token: string

        Target token to revoke.

      Returns Promise<any>

    • Inject custom claims (not supported by default).

      Parameters

      • id: string

        Target user ID.

      • claims: any

        Payload claims.

      Returns Promise<any>

    • Assigns a configuration parameter for the adapter.

      Parameters

      • key: AuthParametersKeys

        The parameter key.

      • value: any

        The parameter value.

      Returns void

    • Signs out the specified user session.

      Parameters

      • user: User

        Target user entity.

      Returns Promise<any>

      Promise resolving to true.

    • Performs user signup with credentials (unsupported for OAuth adapters).

      Parameters

      • login: string

        Login identifier string.

      • password: string

        Password string.

      Returns Promise<any>

      Throws an error indicating signup should use exchangeCodeForToken.

    • Updates user profile attributes in the auth store.

      Parameters

      • user: User

        Target user entity.

      • updatable: any

        Attributes payload to update.

      Returns Promise<any>

      Promise resolving to true.

    • Factory method to create a new instance from config credentials.

      Parameters

      • config: any

      Returns GithubAuthAdapter | null