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

# Add Auth Provider

> Adds or updates an auth provider for a Big Peer app. If a provider with the same name already exists, it will be overwritten with the new provider config.



## OpenAPI

````yaml /ditto-server/operator/operator-api-spec.json post /namespace/{namespace}/bigPeer/{big_peer_name}/app/{app_name}/provider
openapi: 3.1.0
info:
  title: Operator Management API
  description: A RESTful API that allows users to manage Big Peer apps and API keys.
  license:
    name: Ditto Binary License
    identifier: Ditto Binary License
  version: 1.0.0
servers:
  - url: http://localhost:{port}
    description: Local server
    variables:
      port:
        default: '8080'
security: []
tags:
  - name: App
    description: Big Peer apps API endpoints
  - name: API Keys
    description: Big Peer HTTP API keys
  - name: Data Bridge
    description: Apps' data bridges (CDC)
paths:
  /namespace/{namespace}/bigPeer/{big_peer_name}/app/{app_name}/provider:
    post:
      tags:
        - Apps
      summary: Add Auth Provider
      description: >-
        Adds or updates an auth provider for a Big Peer app. If a provider with
        the same name already exists, it will be overwritten with the new
        provider config.
      operationId: createProvider
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddProviderRequest'
        required: true
      responses:
        '200':
          description: Auth provider successfully added or updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/App'
        '400':
          description: bad request
          content:
            application/json:
              examples:
                BigPeerNameMismatch:
                  summary: big peer in app label doesn't match uri parameter
        '404':
          description: app not found
          content:
            application/json:
              examples:
                AppNotFound:
                  summary: big peer app not found
components:
  schemas:
    AddProviderRequest:
      type: object
      required:
        - name
        - config
      properties:
        config:
          oneOf:
            - type: object
              title: TokenWebhook
              description: >-
                Token webhook authentication provider. Validates device tokens
                by calling a user-provided webhook URL. The webhook receives the
                token and returns the authenticated user information and
                permissions.
              properties:
                type:
                  type: string
                  enum:
                    - webhookUrl
                webhookUrl:
                  type: string
                  format: uri
            - type: object
              title: Anonymous
              description: >-
                This is a configuration setting for an anonymous provider. This
                contains what permissions to give anonymous users, how long
                their sessions should last and a shared token. The purpose of
                the shared token is to prevent random scanners on the internet
                from grabbing tokens. The token isn't considered private or
                secure since it will be embedded in a client software.
              required:
                - permission
                - sessionLength
                - sharedToken
                - type
              properties:
                permission: 8ffe439d-5617-4eb4-b5a4-537a8bd5ad50
                sessionLength:
                  type: integer
                  format: u-int32
                  description: Session length in seconds. Minimum is 1 second.
                  minimum: 1
                sharedToken:
                  type: string
                type:
                  type: string
                  enum:
                    - anonymous
          title: ProviderConfig
          description: >-
            This describes the document stored in the __auth_config with the _id
            of auth_config. It describes the auth providers configured for a
            BigPeer App.
        name:
          type: string
    App:
      type: object
      required:
        - name
      properties:
        appId:
          type: string
          title: AppId
          format: uuid
          description: UUID used to identify a BigPeerApp resource
        authProviders:
          type: object
          title: AuthProviders
          description: >-
            Auth providers associated with a BigPeer App, to be used when
            authenticating devices against BigPeer Subscription.
          additionalProperties: 8f67d282-5d96-45f4-b25f-1f3f55a9a68d
        name:
          type: string
          title: Dns1123Label
          description: >-
            RFC 1123 DNS labels used for most Kubernetes resource names.  Some
            resource types require their names to follow the DNS label standard
            as defined in [RFC 1123][rfc1123].
                         This means the name must:
                            * contain at most 63 characters * contain only lowercase alphanumeric characters or '-' * start with an alphanumeric character
                            * end with an alphanumeric character
                        [rfc1123]: https://tools.ietf.org/html/rfc1123
          maxLength: 63
          minLength: 1
          pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$

````