Skip to main content

What is token request ?

The authentication mechanism in restonomer also gives the user a provision to configure the token request.

There are certain scenarios where you are required to provide the authentication credentials for the main data request from the token value provided by some other token request.

Keeping that in mind, user can configure the token request and then can use the token response in the main data request.

Placeholders for token response

User can configure whether the token value needs to be fetched from token response body or token response headers.

The token-response-placeholder config in token-request can be initialised with below 2 values:

  • ResponseBody
  • ResponseHeaders

If the token is to be fetched from the token response body, it is assumed that the token request will always generate the token response in a json format that will contain the attribute required by the main data request.

Token request configuration

The token request can be configured in the token section of the checkpoint configuration file in below manner:

token = {
token-request = {
url = "http://localhost:8080/token-response-body"
}

token-response-placeholder = "ResponseBody"
}

The token-request configuration contains below config options to be provided by the user:

Config NameMandatoryDefault ValueDescription
methodNoGETHttp request method
urlYes-Url for the REST API request
query-paramsNo-The map of query parameters
authenticationNo-The type of authentication mechanism supported by Http Request represented by RestonomerAuthentication class
bodyNo-The request body represented by RestonomerRequestBody body to be send along with the request
headersNo-List of headers to provided as a part of Http request in the form of key-value pairs
retryNo-The auto retry configuration represented by RetryConfig class