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

# Generate OAuth authorization URL

> Generate OAuth authorization URL with state and nonce for CSRF and replay attack protection. State is stored with TTL for validation.



## OpenAPI

````yaml https://api.gumnut.ai/openapi.json get /api/oauth/auth-url
openapi: 3.1.0
info:
  title: Gumnut API
  description: API for using Gumnut to manage photos and videos
  version: 0.1.0
servers: []
security: []
paths:
  /api/oauth/auth-url:
    get:
      tags:
        - oauth
      summary: Generate OAuth authorization URL
      description: >-
        Generate OAuth authorization URL with state and nonce for CSRF and
        replay attack protection. State is stored with TTL for validation.
      operationId: get_auth_url_api_oauth_auth_url_get
      parameters:
        - name: redirect_uri
          in: query
          required: true
          schema:
            type: string
            description: >-
              The URI to redirect to after OAuth consent. Must match the
              registered redirect URI in OAuth client configuration.
            title: Redirect Uri
          description: >-
            The URI to redirect to after OAuth consent. Must match the
            registered redirect URI in OAuth client configuration.
        - name: code_challenge
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              PKCE code challenge derived from code_verifier. Required for
              public clients to prevent authorization code interception attacks.
            title: Code Challenge
          description: >-
            PKCE code challenge derived from code_verifier. Required for public
            clients to prevent authorization code interception attacks.
        - name: code_challenge_method
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              PKCE code challenge method, typically 'S256' (SHA-256 hash). Must
              be provided if code_challenge is specified.
            title: Code Challenge Method
          description: >-
            PKCE code challenge method, typically 'S256' (SHA-256 hash). Must be
            provided if code_challenge is specified.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthUrlResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AuthUrlResponse:
      properties:
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
      type: object
      required:
        - url
      title: AuthUrlResponse
      description: Response containing OAuth authorization URL
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````