UNPKG

@scalar/api-client

Version:

the open source API testing client

34 lines 1.4 kB
import type { OAuthFlowsObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'; import type { ErrorResponse } from '../../../../libs/errors.js'; /** Oauth2 security schemes which are not implicit */ type NonImplicitFlow = Omit<OAuthFlowsObject, 'implicit'>; type PKCEState = { codeVerifier: string; codeChallenge: string; codeChallengeMethod: string; }; /** * Creates a code challenge from the code verifier */ export declare const generateCodeChallenge: (verifier: string, encoding: "SHA-256" | "plain") => Promise<string>; /** * Authorize oauth2 flow * * @returns the accessToken */ export declare const authorizeOauth2: (flows: OAuthFlowsObject, type: keyof OAuthFlowsObject, selectedScopes: string[], /** We use the active server to set a base for relative redirect uris */ activeServer: ServerObject | undefined, /** If we want to use the proxy */ proxyUrl?: string) => Promise<ErrorResponse<string>>; /** * Makes the BE authorization call to grab the token server to server * Used for clientCredentials and authorizationCode */ export declare const authorizeServers: (flows: NonImplicitFlow, type: keyof NonImplicitFlow, scopes: string, { code, pkce, proxyUrl, }?: { code?: string; pkce?: PKCEState | null; proxyUrl?: string | undefined; }) => Promise<ErrorResponse<string>>; export {}; //# sourceMappingURL=oauth.d.ts.map