UNPKG

@timesheet/sdk

Version:
53 lines 1.82 kB
import type { AxiosRequestConfig } from 'axios'; import type { Authentication } from './Authentication'; import { type CodeChallengeMethod, type PkceCodePair } from './pkce'; export interface AuthorizationUrlOptions { clientId: string; redirectUri: string; codeChallenge: string; codeChallengeMethod?: CodeChallengeMethod; state?: string; scope?: string; resource?: string; authorizationEndpoint?: string; } export interface TokenExchangeOptions { clientId: string; clientSecret?: string; authorizationCode: string; redirectUri: string; codeVerifier: string; resource?: string; tokenEndpoint?: string; } export interface OAuth21RefreshOptions { clientId: string; clientSecret?: string; refreshToken: string; resource?: string; tokenEndpoint?: string; } export declare class OAuth21Auth implements Authentication { private static readonly DEFAULT_TOKEN_ENDPOINT; private static readonly DEFAULT_AUTH_ENDPOINT; private accessToken; private refreshToken?; private readonly clientId?; private readonly clientSecret?; private readonly resource?; private readonly tokenEndpoint; private tokenExpiry?; private refreshPromise?; constructor(accessToken: string); constructor(options: OAuth21RefreshOptions); applyAuth(config: AxiosRequestConfig): void; needsRefresh(): boolean; refresh(): Promise<void>; private performRefresh; getAuthHeaders(): Promise<Record<string, string>>; static fromAuthorizationCode(options: TokenExchangeOptions): Promise<OAuth21Auth>; static buildAuthorizationUrl(options: AuthorizationUrlOptions): string; static generatePkce(method?: CodeChallengeMethod): PkceCodePair; private parseTokenExpiry; } //# sourceMappingURL=OAuth21Auth.d.ts.map