Skip to main content

Snowflake Documentation

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:

  1. On the Unravel UI, click manage1.png from the upper right corner and click API Tokens. The API Tokens page is displayed.

  2. Select new.png. The New API Token dialog box is displayed.

  3. 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.

  4. 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.

  5. 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:

  1. On the Unravel UI, click manage1.png from the upper right corner and click API Tokens. The API Tokens page is displayed, which lists the API token details.

  2. Click threedots.png 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:

  1. 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.

  2. Stop Unravel.

    <Unravel installation directory>/unravel/manager stop
  3. 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>
  4. Apply the changes.

    <Unravel installation directory>/unravel/manager config apply
  5. Start Unravel.

    <Unravel installation directory>/unravel/manager start
  6. 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