Authentication
How to use JSON Web Tokens
Last updated
How to use JSON Web Tokens
Last updated
The api-connector
, object-storage/document
, order-search/poll
and shipment/poll
integration API's support two means of authentication:
Using "Basic" HTTP authentication scheme () upon every HTTP request.
Using "Basic" HTTP authentication scheme () to obtain a (). The JWT is used for authentication for all following requests.
Only an integration user is authorised to access the integration API's.
Please contact to assign the integration
role to your integration user.
You can use the Basic HTTP Authentication scheme to authenticate upon every request.
Use Basic Authentication upon every request only when:
You send one order or response occasionally; less then 1 per minute.
And you do not need to integrate with other API's, like the user and company API's
Or when your integration system does not support
You can authenticate using a Basic Authorization HTTP header with a base 64 encoded email and password:
Use the Basic HTTP Authentication scheme to authenticate against the authentication service.
Use the returned JWT to authorize against the Tradecloud api-connector
and other service API's for all subsequent requests.
Use JSON Web Tokens when:
You send batches of orders or responses; more then 1 per minute
Or when you need additional API's, like the user and company API's
You can log in using a Basic Authorization HTTP header with a base 64 encoded email and password:
Use a Bearer Authorization HTTP header with the access token in each request:
An access token will expire after 1 hour and a refresh token after 24 hours. When your access token has expired you have to use the refresh token. If your refresh token expires you have to log in again.
You can refresh your access token by placing an HTTP request to /authentication/refresh
, using
only the Refresh-Token header. Do NOT use the Authorization header.
When the refresh token is valid, the API will return HTTP status code 200 OK
and containing a new access token and a new refresh token. Otherwise, the API will return HTTP status code 401 Unauthorized
The refresh token cannot be used once it is expired or a new refresh token is generated.
Log out will invalidate the refresh token immediately. The access token will expire after 10 minutes.
You can invalidate your refresh token by placing an HTTP request to /authentication/logout
, using
only the Refresh-Token header. Do NOT use the Authorization header.
When correctly authenticated, your request will be processed and if all is well, the response will have OK
When NOT correctly authenticated, the response will return Unauthorized
In case of some server issue, including the upstream authentication service being unreachable,
the response will return Internal Server Error
When correctly authenticated, the response will return OK
and contain access and refresh tokens:
When NOT correctly authenticated, the response will return Unauthorized
in yaml format
When correctly authenticated, your request will be processed and if all is well, the response will have OK