Skip to main content

# Web component integration

## JWT session token generation​

The request returns a JWT token for interacting with the system API.

Endpoint: POST /publicapi/api/v2/public/WebComponentIntegrationsJwt/Generate

Request body:

    {
      "integrationId": "64422e66-911a-43cd-ad3a-5c9461c0b546",
      "secret": "secret"
    }

- integrationId - Integration ID
- secret - Client secret (optional field)

Example request:

    curl -X 'POST' \
      'https:/baf.3divi.ru/publicapi/api/v2/public/WebComponentIntegrationsJwt/Generate' \
      -H 'accept: text/plain' \
      -H 'Authorization: Bearer sk_100e682a-7459-4e53-a152-a8453c5e6ad3' \
      -H 'Content-Type: application/json-patch+json' \
      -d '{
      "integrationId": "64422e66-911a-43cd-ad3a-5c9461c0b546",
      "secret": "secret"
    }'

Example response:

Status Code | 200

    {
      "accessToken": "eyJhbGci..."
    }

Possible errors:

Code | Message | Description | Code
400 | Integration with id 8783ed86-1c08-4a2c-9434-65a8f970f34b not found. | Integration not found | 120024
400 | Client secret is invalid. | Client secret is not provided or the provided value is incorrect. | 120049
400 | Invalid authentication method used. Expected: JWT but integration uses: IntegrationID. | The component authentication type does not support JWT token generation. | 120049