startOAuthRedirect (authentication/oauthLogin.ts)

Dexie.js · addons/dexie-cloud/src/authentication/oauthLogin.ts · typescript · Apache-2.0
auth

Starts an OAuth login flow by redirecting the browser to the provider's authorization endpoint.

// Source: https://github.com/dexie/Dexie.js | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { OAuthError } from '../errors/OAuthError';

/** Options for initiating OAuth redirect */
export interface OAuthRedirectOptions {
  /** The Dexie Cloud database URL */
  databaseUrl: string;
  /** The OAuth provider name */
  provider: string;
  /** Optional redirect URI override.
   * Defaults to window.location.href for web apps.
   * For Capacitor/native apps, use a custom URL scheme like 'myapp://'
   */
  redirectUri?: string;
}

/** Build the OAuth login URL */
function buildOAuthLoginUrl(options: OAuthRedirectOptions): string {
  const url = new URL(`${options.databaseUrl}/oa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key