interface OAuthToken { access_token: string; token_type: string; expires_in?: number; refresh_token?: string; scope?: string; created_at: number; }
@vibe-kit/auth/node
class ClaudeAuth { // Start OAuth flow (opens browser automatically) static authenticate(): Promise<OAuthToken>; // Check if user is authenticated static isAuthenticated(): Promise<boolean>; // Get valid token (auto-refresh if needed) static getValidToken(): Promise<string | null>; // Verify current authentication static verify(): Promise<boolean>; // Get authentication status static getStatus(): Promise<any>; // Logout and clear tokens static logout(): Promise<void>; // Export token in different formats static exportToken(format: 'env' | 'json' | 'full'): Promise<string>; // Import token from various sources static importToken(options: { fromEnv?: boolean; fromFile?: string; refreshToken?: string; }): Promise<void>; }
class ClaudeWebAuth { constructor(storage: TokenStorage); // Create authorization URL with PKCE static createAuthorizationUrl(): { url: string; state: string; codeVerifier: string; }; // Complete authentication with auth code authenticate( authCode: string, codeVerifier: string, state: string ): Promise<OAuthToken>; // Check if authenticated isAuthenticated(): Promise<boolean>; // Get valid token (auto-refresh if needed) getValidToken(): Promise<string | null>; }
interface TokenStorage { store(token: OAuthToken): Promise<void>; retrieve(): Promise<OAuthToken | null>; clear(): Promise<void>; }