UNPKG

@ioloco/oauth

Version:

OAuth 2.0 utility library that provides helper functions for integrating third-party login providers. Designed to simplify the token exchange and user-fetch flows, while leaving API route implementation to the developer.

36 lines (35 loc) 817 B
export type OauthProvider = string; export interface Cookies { get(name: string): { value: string; } | undefined; set(name: string, value: string, options?: { secure?: boolean; httpOnly?: boolean; sameSite?: 'lax' | 'strict' | 'none'; expires?: Date; }): void; delete(name: string): void; } export type OAuthTokenResponse = { accessToken: string; tokenType: string; refreshToken?: string; expiresIn?: number; scope?: string; }; export type OAuthUserResult = { user: { id: string; email: string; name: string; [key: string]: unknown; }; accessToken: string; refreshToken?: string; expiresIn?: number; scope?: string; }; export type AuthUrlOptions = { forceConsent?: boolean; };