Generate bearer token
Bearer token is a type of access token that is used in the authentication and authorisation processes for APIs. It is a string that provides the user or system the identity to access sensitive resources or actions on a server. Bearer tokens are commonly used in the token-based authentication systems, such as OAuth2.
Generating a bearer token is essential for securely managing access to APIs, allowing for robust authentication mechanisms while maintaining a stateless, scalable architecture.
Note
This section explains the process of generating the bearer token via the Postman application. You may use other platforms to generate the bearer token, if applicable.
To generate the bearer token via the Postman application, follow the instructions as explained in the following procedure.
- Launch the Postman application or log in into your Postman account. If you have selected the online version, make sure to activate your account.
Tip
If you do not have the Postman application, you can download it here or register for an online Postman account, respectively.
- After successfully logging in, on your workspace toolbar, select New > HTTP . Alternatively, on your workspace, select + tab to add a new HTTP request tab.
- In the new request tab that opens, from the left dropdown menu, select POST and enter the following URL in the Enter request URL field.
- Now, select the Body tab and then click the x-www-form-urlencoded option. In the table that appears, enter the following key-value pairs in the KEY column:
- client_id
- client_secret
- grant_type
After, in the VALUE column, enter the credentials generated via the SAPIENT API Credentials functionality. For the grant_type key, set the value to client-credentials.
- After entering the necessary information, select Send.
- If the credentials match the ones that have been set in the Create API Credentials functionality, then the bearer token is returned in the response.
- The expires in value returned in the preceding token response is the amount of time the token is valid in seconds (that is, 3600 seconds = 60 minutes).
Important
Please ensure you cache the authentication token and check for expiry before requesting a new one.
- You can use the generated bearer token provided in the API References section for testing purposes.
Once the bearer token has been generated successfully, you can now use it for authentication purposes.
Updated 22 days ago