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

# Initiate and Complete Discord OAuth Flow

> Handles the Discord OAuth callback to exchange an authorization code for user access and refresh tokens. Upon successful authentication, returns the token details.



## OpenAPI

````yaml https://stash.seraph.si/json get /discord/oauth
openapi: 3.1.0
info:
  contact:
    email: support@seraph.si
    name: API Support
    url: https://discord.gg/seraph
  title: Seraph API
  version: '4.0'
servers: []
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /discord/oauth:
    get:
      tags:
        - Discord
        - Authentication
      summary: Initiate and Complete Discord OAuth Flow
      description: >-
        Handles the Discord OAuth callback to exchange an authorization code for
        user access and refresh tokens. Upon successful authentication, returns
        the token details.
      parameters:
        - description: The authorization code received from Discord after user consent
          in: query
          name: code
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: >-
            Successfully exchanged authorization code for access and refresh
            tokens
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/validation.ErrorResponse'
          description: >-
            Bad request, e.g., missing 'code' parameter or invalid authorization
            code
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/validation.ErrorResponse'
          description: Internal server error during token exchange or user processing
components:
  schemas:
    validation.ErrorResponse:
      properties:
        cause:
          type: string
        code:
          type: integer
        documentation:
          type: string
        extra:
          items:
            $ref: '#/components/schemas/validation.ErrorObject'
          type: array
          uniqueItems: false
        msTime:
          type: integer
        success:
          type: boolean
      type: object
    validation.ErrorObject:
      properties:
        code:
          type: integer
        developer_reason:
          type: string
        name:
          type: string
        reason:
          type: string
      type: object

````