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 by an administrator from the Unravel UI. Do the following:
On the Unravel UI, click from the upper right corner and click API Tokens. The API Tokens page is displayed.
Select . The New API Token dialog box is displayed.
Specify the following details:
Client Id
Specify an ID for the client. For example, dfsadmin.
Role
Select one of the following roles:
Admin
Choose this option to generate a token for the admin role.
User
Choose this option to generate a token for the user or a non-admin role.
If you have selected the user role, you can choose the associated tags from Tags.
Click Create. A new API token is created and listed in the API token list.
In the API tokens list, all the details you have selected while creating an API token are displayed along with the assigned token.
Click the Copy Token link to copy the token for use.
Caution
If you have not configured to store persistent API tokens, the tokens get deleted every time you restart the server.
Deleting an API token
Do the following to delete an API token:
On the Unravel UI, click from the upper right corner and click API Tokens. The API Tokens page is displayed, which lists the API token details.
Click corresponding to the API token that you want to delete and then click Delete.
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