Token based Authentication in Standard Dynamic API

Generate authentication token using GenerateToken API. Use the generated token to fetch details of an API based on JWT token based authentication for standard and dynamic API.

Prerequisites:

For JWT token based authentication, following keys must be enabled in the web.config file:

  • <add key=”JWT:EnableToken” value=”true” />
  • <add key=”JWT:SecretKey” value=”C1CF4B7DC4C1475B6618DE4F55CA4ASD24” />
  • <add key=”JWT:ExpireMins” value=”4” />

Generate Token 

Generate authentication tokens using GenerateTokenAPI. These authentication tokens are used to provide a secure path to access restricted applications.

The HTTP type for GenerateTokenAPI is GET type.

Generate the token by passing either of the following fields in the Headers section of Postman application:

  1. UserName and Password, or;
  2. API Key

If API Key is enabled, then generate the token based on the API Key. If the API Key is disabled, then generate the token using Username and Password.

Perform the following steps to generate token using GenerateTokenAPI.

  1. Open the Postman application.
  2. Select HTTP Method as GET.
  3. Click Headers tab.
  4. Enter the username and password or the API key.
  5. Click Send.

Get details of an API through JWT token based authentication in Standard and Dynamic API 

After generating the token using GenerateTokenAPI, use any one of the below methods to get the details of standard API using the generated token through JWT token based authentication.

Method 1: 

  1. Open the Postman application.
  2. Select HTTP Method as POST.
  3. Navigate to Auth.
  4. Select Type as Bearer Token.
  5. Paste the token generated in the Token field.
  6. Click Send.

Method 2: 

  1. Open the Postman application.
  2. Select HTTP Method as POST.
  3. Navigate to Headers.
  4. Paste the Token in the Authorization field.
  5. Click Send.

Details of the API are displayed. If the Token is wrong or if the validity time of the token has expired, then the result will show an error stating ‘Invalid or Expired Token’.

Note

If using JWT token based authentication is enabled, then no other authentication mechanism will work.