# Authentication


The complete OpenAPI specification:

```yaml
openapi: 3.0.3
info:
  version: 1.0.0
  title: Identity Service
  description: OpenID Connect / OAuth 2.0 token endpoint for the Clay identity service.
servers:
  - url: https://identity-acc.eu.my-clay.com
    description: Acceptance environment
  - url: https://identity.eu.my-clay.com
    description: Production environment
tags:
  - name: Token
    description: OAuth 2.0 token operations.
paths:
  /connect/token:
    post:
      tags:
        - Token
      summary: Request an access token
      description: >-
        OAuth 2.0 token endpoint. Exchange client credentials for an access
        token.
      security:
        - clientSecretBasic: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenRequest'
      responses:
        '200':
          description: Token successfully issued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenError'
components:
  securitySchemes:
    clientSecretBasic:
      type: http
      scheme: basic
      description: >-
        Client authentication using HTTP Basic (client_id:client_secret).
  schemas:
    TokenRequest:
      type: object
      required:
        - grant_type
      properties:
        grant_type:
          type: string
          description: The OAuth 2.0 grant type. (client_credentials)
          example: client_credentials
        scope:
          type: string
          description: Read/Write access to feature API. (xs4face.featureapi.users xs4face.featureapi.enrollment)
          example: xs4face.featureapi.users xs4face.featureapi.enrollment
        client_id:
          type: string
          description: Client identifier. Required when using client_secret_post authentication.
        client_secret:
          type: string
          description: Client secret. Required when using client_secret_post authentication.
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
          description: The issued access token.
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: integer
          description: Token lifetime in seconds.
          example: 3600
        scope:
          type: string
          description: The scopes granted for the access token.
    TokenError:
      type: object
      properties:
        error:
          type: string
          example: invalid_client
        error_description:
          type: string
```

