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

# OAuth callback

> Handle OAuth callback to complete user credential brokering flow



## OpenAPI

````yaml api-reference/openapi.json get /api/bridge/v1/generic-oauth-callback
openapi: 3.1.0
info:
  title: soma
  version: v1
servers: []
security: []
tags:
  - name: task
    description: >-
      Task management endpoints for creating, listing, and managing tasks and
      their messages
  - name: secret
    description: Secret management endpoints for storing and retrieving encrypted secrets
  - name: encryption
    description: >-
      Encryption key management endpoints for envelope keys, data encryption
      keys, and aliases
  - name: bridge
    description: >-
      Bridge endpoints for managing providers, credentials, functions, and MCP
      protocol communication
  - name: _internal
    description: >-
      Internal endpoints for health checks, runtime configuration, and SDK code
      generation
  - name: a2a
    description: >-
      Agent-to-agent communication endpoints for agent cards, definitions, and
      JSON-RPC requests
  - name: v1
    description: API version v1 endpoints
paths:
  /api/bridge/v1/generic-oauth-callback:
    get:
      tags:
        - bridge
        - v1
      summary: OAuth callback
      description: Handle OAuth callback to complete user credential brokering flow
      operationId: resume-user-credential-brokering
      parameters:
        - name: state
          in: query
          description: OAuth state parameter
          required: false
          schema:
            type: string
        - name: code
          in: query
          description: OAuth authorization code
          required: false
          schema:
            type: string
        - name: error
          in: query
          description: OAuth error code
          required: false
          schema:
            type: string
        - name: error_description
          in: query
          description: OAuth error description
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Generic OAuth callback
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserCredentialBrokeringResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UserCredentialBrokeringResponse:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/BrokerState'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - broker_state
        - allOf:
            - $ref: '#/components/schemas/UserCredentialSerialized'
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - user_credential
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - redirect
    Error:
      type: object
      required:
        - message
      properties:
        data: {}
        message:
          type: string
    BrokerState:
      type: object
      required:
        - id
        - created_at
        - updated_at
        - provider_instance_id
        - provider_controller_type_id
        - credential_controller_type_id
        - metadata
        - action
      properties:
        action:
          $ref: '#/components/schemas/BrokerAction'
        created_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
        credential_controller_type_id:
          type: string
        id:
          type: string
        metadata:
          $ref: '#/components/schemas/Metadata'
        provider_controller_type_id:
          type: string
        provider_instance_id:
          type: string
        updated_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
    UserCredentialSerialized:
      type: object
      required:
        - id
        - type_id
        - metadata
        - value
        - created_at
        - updated_at
        - dek_alias
      properties:
        created_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
        dek_alias:
          type: string
        id:
          $ref: '#/components/schemas/WrappedUuidV4'
        metadata:
          $ref: '#/components/schemas/Metadata'
        next_rotation_time:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/WrappedChronoDateTime'
        type_id:
          type: string
        updated_at:
          $ref: '#/components/schemas/WrappedChronoDateTime'
        value:
          $ref: '#/components/schemas/WrappedJsonValue'
    BrokerAction:
      oneOf:
        - type: object
          required:
            - Redirect
          properties:
            Redirect:
              $ref: '#/components/schemas/BrokerActionRedirect'
        - type: string
          enum:
            - None
    WrappedChronoDateTime:
      type: string
      format: date-time
    Metadata:
      type: object
      additionalProperties: {}
      propertyNames:
        type: string
    WrappedUuidV4:
      type: string
      format: uuid
    WrappedJsonValue: {}
    BrokerActionRedirect:
      type: object
      required:
        - url
      properties:
        url:
          type: string

````