Interface AuthInterface<AuthOptions, Authentication>

Interface to implement complex authentication strategies for Octokit. An object Implementing the AuthInterface can directly be passed as the auth option in the Octokit constructor.

For the official implementations of the most common authentication strategies, see https://github.com/octokit/auth.js

interface AuthInterface<AuthOptions, Authentication> {
    hook: {
        <T>(request: RequestInterface<object>, options: EndpointOptions): Promise<OctokitResponse<T, number>>;
        <T>(request: RequestInterface<object>, route: string, parameters?: RequestParameters): Promise<OctokitResponse<T, number>>;
    };
    (...args: AuthOptions): Promise<Authentication>;
}

Type Parameters

  • AuthOptions extends any[]
  • Authentication extends any

Properties

Properties

hook: {
    <T>(request: RequestInterface<object>, options: EndpointOptions): Promise<OctokitResponse<T, number>>;
    <T>(request: RequestInterface<object>, route: string, parameters?: RequestParameters): Promise<OctokitResponse<T, number>>;
}

Type declaration

    • <T>(request, options): Promise<OctokitResponse<T, number>>
    • Sends a request using the passed request instance

      Type Parameters

      • T = any

      Parameters

      Returns Promise<OctokitResponse<T, number>>

    • <T>(request, route, parameters?): Promise<OctokitResponse<T, number>>
    • Sends a request using the passed request instance

      Type Parameters

      • T = any

      Parameters

      • request: RequestInterface<object>
      • route: string

        Request method + URL. Example: 'GET /orgs/{org}'

      • Optionalparameters: RequestParameters

        URL, query or body parameters, as well as headers, mediaType.{format|previews}, request, or baseUrl.

      Returns Promise<OctokitResponse<T, number>>