UNPKG

fathom-typescript

Version:

Fathom's official TypeScript SDK.

23 lines (18 loc) 665 B
export type GetAuthorizationUrlRequest = { clientId: string; redirectUri: string; scope: string; state?: string; }; export function getAuthorizationUrl( request: GetAuthorizationUrlRequest, ): string { const state = request.state ?? Math.random().toString(36).substring(2, 15); const url = new URL("https://fathom.video/external/v1/oauth2/authorize"); url.searchParams.append("client_id", request.clientId); url.searchParams.append("redirect_uri", request.redirectUri); url.searchParams.append("scope", request.scope); url.searchParams.append("state", state); url.searchParams.append("response_type", "code"); return url.toString(); }