Authentication process
This guide will help you manage the authentication process and token refresh
Last updated
This guide will help you manage the authentication process and token refresh
Last updated
To access our API services, users must first obtain an API token by making a POST request to api.waldo.ai/authentication
. The request should include two parameters in the request body:
apiKey
: Your unique API key.
clientSecret
: Your client secret.
POST
https://api.waldo.ai/authenticate
Name | Type | Description |
---|---|---|
A successful request will return a JSON Web Token (JWT) in the response. This JWT token will be used to authorize your subsequent API requests.
View the authentication request in detail in the API Reference section.
Once you have obtained your JWT token, you should include it in the Authorization
header of every API request you make. Set the header value as follows:
This header informs our API that you are an authorized user, allowing you to access the requested resources.
To ensure uninterrupted access to our API services, you should be aware of token expiration and refresh your token as needed.
Tokens issued by our API have a one-hour expiry period. After this period, the token becomes invalid, and you will need to obtain a new one to continue accessing our services.
After each successful API request, our API will include a new JWT token in the response headers. More precisely, you will find the new token in the Authorization
header.
This token is generated automatically by our system and is used to refresh your current token.
To make use of this feature, it is recommended that you verify the expiration date of your token with each API request. If your token is about to expire, simply use the new token provided in the response header to replace the old one in your subsequent requests.
Here's an example of how you can handle token refresh:
Make an API request with your current token.
Check the response headers for a new token (Authorization: Bearer new-jwt-token
).
Replace your old token with the new one in subsequent requests.
Here's an example in Node.js using ESM (ECMAScript Modules) to demonstrate how to refresh the token after each API request.
First, make sure you have Node.js installed with support for ESM. You can create a JavaScript file (e.g., api.js
) with the following code:
Note: replace in the code above /some-endpoint
with the appropriate endpoint.
apiKey*
String
clientSecret*
String