client_credentials grant. You exchange a client ID
and a client secret for a short-lived access token, then send that token on
every other request.
Requests go to the Document Verification deployment in your cloud environment.
Get credentials
Ask your Trelent admin for a client ID and secret, the list of scopes that your client holds, and the base URL of the environment you are given. Put the secret in your secret manager. Every example on these pages reads the base URL fromTRELENT_API_URL:
Get a token
Post a form to/token. The body is form-encoded, not JSON.
- cURL
- Python
- TypeScript
Send the token
Put the token in theAuthorization header of every /v1 request:
expires_in rather than assuming a
value, and do not cache a token whose expires_in is 0.
Scopes
In most cases, requestingDocumentVerification:* gives you access to every
operation, and it is the best path forward if your client holds it.
The authorization server grants only the scopes you name in the request, and
it matches them against your client’s registration. If your client does not
hold
DocumentVerification:*, ask for the scopes it does hold. Read the
scope field of the answer to confirm what you received.The individual scopes
Use these if your client holds a narrower set. They are also worth knowing so that you can read a403 message, which names the scope it wanted.
Wildcards nest.
DocumentVerification:* covers everything above;
DocumentVerification:detections:* covers every detection scope.
When authentication fails
A
403 names the scopes it wanted. Read them from the message; that is faster
than guessing.