API authorization token
You can create tokens for API token authorization, which is required while interacting with Unravel APIs. These API tokens get deleted after you restart Unravel. Therefore to maintain the token permanently, you must set properties to store persistent API Tokens.
Create a token for API token authorization
API tokens can be created from Unravel UI. Do the following:
On the Unravel UI, click from the upper right corner and then select API Tokens.
Click New API Token.
In the New API Token dialog box, specify a client ID, select the admin role, and click Create. A new API token is created and listed in the API token list. Click to copy the token and click to delete the token.
Note
If you have not configured to store persistent API tokens, the tokens get deleted every time you restart the server.
Storing persistent API authorization tokens
The token used for API token authorization gets deleted every time there is a server restart. This can be avoided, and the API token can be maintained permanently. Do the following:
Create a JSON file in a location accessible only to the Unravel user. For example, you create a
token.json
file in the/user/unravel
directory.Note
Create this JSON file in a location accessible only to the Unravel user.
Stop Unravel.
<Unravel installation directory>/unravel/manager stop
Set the following Unravel property and in this property, provide the path to the JSON file you created in Step 1.
<Unravel installation directory>/unravel/manager config properties set com.unraveldata.api.access.tokens.store
</path/to/JSON file>
Apply the changes.
<Unravel installation directory>/unravel/manager config apply
Start Unravel.
<Unravel installation directory>/unravel/manager start
From the Unravel UI, create the API token. The newly created API tokens are now permanently stored in the specified JSON file, and these tokens are not deleted after the server is restarted.
Also, refer, Rotating the JSON web token (JWT) secret