Authentication - Getting Started
sequenceDiagram
participant Client
participant Complyt API
Client->>Complyt API: POST /v1/token<br>Payload: <br>{"clientId": "A414...GsFf87t",<br>"clientSecret": "HHCv...gQ491nSVed35"}
Note right of Client: Sending authentication request
Complyt API-->>Client: 200 OK<br>Response: <br>{"accessToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",<br>"tokenType":"Bearer",<br>"expiresIn":86400}
Note left of Complyt API: Access token returned
Use Complyt API to obtain Auth0 bearer token. To do this, you’ll need to send a POST request to complyt token endpoint, passing your client ID and client secret in the request body. Here’s an example cURL command to do this:
curl --request POST \
--url 'https://demo.complyt.io/v1/token' \
--header 'content-type: application/json' \
--data '{
"clientId": "A414......................GsFf87t",
"clientSecret": "HHCv..............gQ491nSVed35"
}'
Replace the placeholders with your actual client ID and client secret.
Response
If the request is successful, you’ll receive a JSON response that includes an access token. The access token is your bearer token, which you can use to authenticate requests to your M2M application’s API. Here’s an example response:
{
"accessToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"tokenType":"Bearer",
"expiresIn":86400
}
:::check
That’s it! You can now use the access token as a bearer token to authenticate requests to your M2M application’s API. Please note that the token expires in 24 hours, so either re-generate it with every request or re-generate it daily.
:::
:::highlight blue {icon="lucide-timer"}
The token expires in 86400 seconds (24 hours), consider either:
- Re-generating the token with each request
- Implementing a mechanism to refresh the token daily
:::