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

# OAuth authorize endpoint

> This endpoint is used to initiate the OAuth authorization flow. there are two purposes for this endpoint: 1. Authenticate a user with an OAuth provider. 2. Link an existing user with an OAuth provider.



## OpenAPI

````yaml /openapi/server.json get /auth/oauth/authorize/{provider_id}
openapi: 3.1.0
info:
  title: Hexclave REST API
  version: 1.0.0
  description: >-
    The Hexclave REST API. All request headers are documented as canonical
    `X-Hexclave-*`; the equivalent `X-Stack-*` aliases are accepted on every
    endpoint for backwards compatibility. Response headers
    `X-Hexclave-actual-status`, `X-Hexclave-known-error`, and
    `X-Hexclave-request-id` are emitted alongside their legacy `X-Stack-*`
    equivalents.
servers:
  - url: https://api.hexclave.com/api/v1
    description: Hexclave REST API
security: []
paths:
  /auth/oauth/authorize/{provider_id}:
    get:
      tags:
        - Oauth
      summary: OAuth authorize endpoint
      description: >-
        This endpoint is used to initiate the OAuth authorization flow. there
        are two purposes for this endpoint: 1. Authenticate a user with an OAuth
        provider. 2. Link an existing user with an OAuth provider.
      parameters:
        - name: type
          in: query
          schema:
            type: string
            enum:
              - authenticate
              - link
            default: authenticate
          required: false
        - name: token
          in: query
          schema:
            type: string
            default: ''
          required: false
        - name: provider_scope
          in: query
          schema:
            type: string
          required: false
        - name: error_redirect_uri
          in: query
          schema:
            type: string
          required: false
        - name: after_callback_redirect_url
          in: query
          schema:
            type: string
          required: false
        - name: stack_response_mode
          in: query
          schema:
            type: string
            enum:
              - json
              - redirect
            description: >-
              Response mode for the OAuth authorize endpoint. Defaults to
              'redirect' if not provided.
          description: >-
            Response mode for the OAuth authorize endpoint. Defaults to
            'redirect' if not provided.
          required: false
        - name: hexclave_response_mode
          in: query
          schema:
            type: string
            enum:
              - json
              - redirect
            description: >-
              Response mode for the OAuth authorize endpoint. Defaults to
              'redirect' if not provided.
          description: >-
            Response mode for the OAuth authorize endpoint. Defaults to
            'redirect' if not provided.
          required: false
        - name: bot_challenge_token
          in: query
          schema:
            type: string
          required: false
        - name: bot_challenge_phase
          in: query
          schema:
            type: string
            enum:
              - invisible
              - visible
          required: false
        - name: bot_challenge_unavailable
          in: query
          schema:
            type: string
            enum:
              - 'true'
          required: false
        - name: client_id
          in: query
          schema:
            type: string
          required: true
        - name: client_secret
          in: query
          schema:
            type: string
          required: true
        - name: redirect_uri
          in: query
          schema:
            type: string
          required: true
        - name: scope
          in: query
          schema:
            type: string
          required: true
        - name: state
          in: query
          schema:
            type: string
          required: true
        - name: grant_type
          in: query
          schema:
            type: string
            enum:
              - authorization_code
          required: true
        - name: code_challenge
          in: query
          schema:
            type: string
          required: true
        - name: code_challenge_method
          in: query
          schema:
            type: string
            enum:
              - S256
          required: true
        - name: response_type
          in: query
          schema:
            type: string
          required: true
        - name: provider_id
          in: path
          schema:
            type: string
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  location:
                    type: string
                required:
                  - location
        '307':
          description: Successful response
          content:
            text/plain:
              schema:
                type: string

````