Generate an Access Token¶
Using access tokens for request authorization enhances security by preventing certain types of denial-of-service (DoS) attacks on published APIs. API consumers generate access tokens to access APIs, including them as string values in HTTP header requests.
When you register an application in the Developer Portal, you can generate a consumer key and consumer secret. These credentials represent the application's identity. The consumer key acts as the unique identifier for the application, similar to a username, and is used to authenticate API requests. Choreo issues an access token for the application based on the consumer key.
This guide walks you through the steps to generate an access token for your application in Choreo.
Prerequisites¶
Before proceeding, ensure you have the following:
- An application in the Choreo Developer Portal. If you don’t have one, create a new application.
- Generate keys for the application.
- Subscribe APIs to the application.
Generate an access token via curl¶
Follow these steps to generate an access token for your application using cURL:
-
In the Choreo Developer Portal header, click Applications.
-
On the My Applications page, click on the application for which you want to generate the token.
-
In the left navigation menu, click the desired environment under Credentials. This opens the Application Keys pane for that environment.
-
Copy the Consumer key, Consumer secret, and Token endpoint values.
-
Use the following template and replace the placeholders with the values you copied:
-
Run the curl command to generate an access token.
Generate an access token via the Developer Portal UI (for testing)¶
To generate an access token for testing purposes, follow these steps:
-
In the Choreo Developer Portal header, click Applications.
-
On the My Applications page, click on the application for which you want to generate keys and tokens.
-
In the left navigation menu, click the desired environment under Credentials. This opens the Application Keys pane for that environment.
-
Click Generate Token to create a test access token.