/** * OAuth 2.0 Tokens returned from provider after code exchange */ export interface OAuthTokens { accessToken: string; refreshToken?: string; expiresIn?: number; scope?: string; } /** * Normalized OAuth user profile across all providers */ export interface OAuthProfile { id: string; email: string; name?: string; avatarUrl?: string; raw: any; } /** * Parameters for generating OAuth authorization URL */ export interface AuthorizationUrlParams { state: string; redirectUri: string; scope: string[]; } /** * Parameters for exchanging authorization code for access token */ export interface TokenExchangeParams { code: string; redirectUri: string; } /** * Configuration for OAuth provider */ export interface ProviderConfig { clientId: string; clientSecret: string; callbackUrl: string; scope?: string[]; } /** * Base interface for OAuth 2.0 providers * * Implementations must provide methods for: * - Generating authorization URLs * - Exchanging authorization codes for access tokens * - Fetching user profiles from the provider */ export interface OAuthProvider { /** * Provider name (e.g., 'github', 'google') */ name: string; /** * Generate OAuth authorization URL for initiating the flow */ getAuthorizationUrl(params: AuthorizationUrlParams): string; /** * Exchange authorization code for access token */ exchangeCodeForToken(params: TokenExchangeParams): Promise; /** * Fetch user profile from provider using access token */ getUserProfile(accessToken: string): Promise; }