> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prelude.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Initiate OAuth authorization

> Start an OAuth authorization flow for the given provider. Returns the authorization URL to redirect the user to.



## OpenAPI

````yaml post /v1/session/login/oauth/{provider}/authorize
openapi: 3.1.1
info:
  title: Prelude Session Frontend API
  version: 0.0.1
  description: The Prelude Frontend API for Session Management
  contact:
    email: support@prelude.so
servers:
  - url: https://{appId}.session.prelude.dev
    description: Production server
    variables:
      appId:
        default: changeme
        description: The appID
security: []
tags:
  - name: Login OTP
    description: Login and step-up via OTP (phone or email)
  - name: Login Email Password
    description: Login via email and password
  - name: Login OAuth
    description: Login via OAuth providers
  - name: Login Finalize
    description: Finalize a login flow and create a session
  - name: Login Migration
    description: Migrate sessions from a legacy authentication system
  - name: Session
    description: Session refresh and revocation
  - name: Session Management
    description: Authenticated session and identifier management
  - name: Step-Up
    description: Step-up authentication flow
  - name: Well-Known
    description: Public key discovery endpoints
  - name: Password
    description: Password compliancy and change password
paths:
  /v1/session/login/oauth/{provider}/authorize:
    post:
      tags:
        - Login OAuth
      summary: Initiate OAuth authorization
      description: >-
        Start an OAuth authorization flow for the given provider. Returns the
        authorization URL to redirect the user to.
      operationId: oauthAuthorize
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            type: string
            examples:
              - google
          description: The OAuth provider identifier (e.g., "google", "apple", "facebook")
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthAuthorizeRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthAuthorizeResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/BadRequestError'
                  - $ref: '#/components/schemas/OAuthProviderNotConfiguredError'
                  - $ref: '#/components/schemas/OAuthProviderDisabledError'
                  - $ref: '#/components/schemas/InvalidRedirectURIError'
        '500':
          description: Internal Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalError'
components:
  schemas:
    OAuthAuthorizeRequest:
      type: object
      properties:
        redirect_uri:
          type: string
          description: The URI to redirect to after OAuth authorization.
          examples:
            - https://example.com/callback
        code_challenge:
          type: string
          description: PKCE code challenge for the OAuth flow.
          examples:
            - E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
        dispatch_id:
          type: string
          description: The identifier of the dispatch from the front-end SDK.
          examples:
            - 123e4567-e89b-12d3-a456-426614174000
      required:
        - redirect_uri
        - code_challenge
    OAuthAuthorizeResponse:
      type: object
      properties:
        authorization_url:
          type: string
          description: The URL to redirect the user to for OAuth authorization.
          examples:
            - >-
              https://accounts.google.com/o/oauth2/v2/auth?client_id=...&redirect_uri=...&scope=openid+email&state=...
      required:
        - authorization_url
    BadRequestError:
      type: object
      properties:
        code:
          type: string
          enum:
            - bad_request
        type:
          type: string
          enum:
            - bad_request
    OAuthProviderNotConfiguredError:
      type: object
      properties:
        code:
          type: string
          enum:
            - oauth_provider_not_configured
        type:
          type: string
          enum:
            - bad_request
    OAuthProviderDisabledError:
      type: object
      properties:
        code:
          type: string
          enum:
            - oauth_provider_disabled
        type:
          type: string
          enum:
            - bad_request
    InvalidRedirectURIError:
      type: object
      properties:
        code:
          type: string
          enum:
            - invalid_redirect_uri
        type:
          type: string
          enum:
            - bad_request
    InternalError:
      type: object
      properties:
        code:
          type: string
          enum:
            - internal
        type:
          type: string
          enum:
            - internal

````