buildAuthorizationURL (libs/auth-oidc.ts)

airi · packages/stage-ui/src/libs/auth-oidc.ts · typescript · MIT
auth

Utility functions implementing OIDC PKCE flow: build URL, exchange code, refresh token, and state persistence.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import { generateCodeChallenge, generateCodeVerifier, generateState } from '@proj-airi/stage-shared/auth'

import { SERVER_URL } from './server'

// OIDC Authorization Code + PKCE client for all platforms.

const OIDC_AUTHORIZE_PATH = '/api/auth/oauth2/authorize'
const OIDC_TOKEN_PATH = '/api/auth/oauth2/token'

export interface OIDCFlowParams {
  clientId: string
  redirectUri: string
  scopes?: string[]
  /**
   * Client secret — required when the OIDC client is registered as
   * confidential on the server. Omit for public clients.
   */
  clientSecret?: string
  /** Social provider hint — skips the server-side picker page. */
  

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

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

Get a free API key