@timesheet/sdk
Version:
Official TypeScript SDK for the Timesheet API
22 lines • 1 kB
TypeScript
import type { AxiosRequestConfig } from 'axios';
import type { Authentication } from './Authentication';
export declare class OAuth2Auth implements Authentication {
private static readonly TOKEN_ENDPOINT;
private accessToken;
private refreshToken?;
private readonly clientId?;
private readonly clientSecret?;
private tokenExpiry?;
private refreshPromise?;
constructor(accessToken: string);
constructor(clientId: string, clientSecret: string, refreshToken: string);
applyAuth(config: AxiosRequestConfig): void;
needsRefresh(): boolean;
refresh(): Promise<void>;
private performRefresh;
getAuthHeaders(): Promise<Record<string, string>>;
static fromAuthorizationCode(clientId: string, clientSecret: string, authorizationCode: string, redirectUri: string): Promise<OAuth2Auth>;
static buildAuthorizationUrl(clientId: string, redirectUri: string, state?: string): string;
private parseTokenExpiry;
}
//# sourceMappingURL=OAuth2Auth.d.ts.map