/** * OAuth2 Authentication Module for Upwork API * * This module handles OAuth2 authentication flows including: * - Authorization Code Grant * - Client Credentials Grant * - Refresh Token Grant * - Implicit Grant */ import { AuthConfig, AuthorizationOptions, TokenResponse } from "../types"; export declare class UpworkAuth { private clientId; private clientSecret; private redirectUri?; private baseUrl; private tokenUrl; private authUrl; private accessToken; private refreshToken; private tokenExpiry; /** * Create an authentication instance * @param config - Configuration object */ constructor(config: AuthConfig); /** * Generate authorization URL for Authorization Code Grant * @param options - Authorization options * @returns Authorization URL */ getAuthorizationUrl(options?: AuthorizationOptions): string; /** * Get authorization URL for Implicit Grant * @param options - Authorization options * @returns Authorization URL */ getImplicitGrantUrl(options?: AuthorizationOptions): string; /** * Exchange authorization code for access token * @param code - Authorization code from callback * @returns Token response */ getAccessToken(code: string): Promise; /** * Get access token using Client Credentials Grant * @param options - Options * @returns Token response */ getClientCredentialsToken(options?: AuthorizationOptions): Promise; /** * Refresh access token using refresh token * @param refreshToken - Refresh token (uses stored token if not provided) * @returns Token response */ refreshAccessToken(refreshToken?: string): Promise; /** * Set tokens from OAuth response * @param tokenData - Token response data */ private setTokens; /** * Check if access token is expired * @returns True if token is expired or about to expire */ isTokenExpired(): boolean; /** * Get valid access token, refreshing if necessary * @returns Valid access token */ getValidToken(): Promise; /** * Set access token manually (for tokens obtained outside this library) * @param accessToken - Access token * @param refreshToken - Refresh token * @param expiresIn - Expiry time in seconds */ setAccessToken(accessToken: string, refreshToken?: string, expiresIn?: number): void; /** * Get current access token without validation * @returns Current access token or null */ getCurrentAccessToken(): string | null; /** * Get current refresh token * @returns Current refresh token or null */ getCurrentRefreshToken(): string | null; /** * Handle authentication errors * @param error - Error object * @returns Formatted error */ private handleAuthError; } //# sourceMappingURL=auth.d.ts.map