Custom authentication mode
This authentication mode is used for complex authentication, frequently used to call API wrapping protocols such as OAuth2, to retrieve an access token to be injected in the real HTTP request for the action.
When you configure the custom authentication, you can click on the button below to check if the custom authentication payload is correctly configured.
If the test is successful, the button turns green.
With this authentication, the action execution is a two-step process:
- Call the endpoint to generate the access token.
- Call the REST API by injecting in the proper way the access token.
This authentication has two parts.
The definition of the endpoint to be called to generate the access token:
-
endpoint: URL to use to generate the endpoint
-
method of the HTTP request on the endpoint (GET or POST)
-
headers: key/value pairs to be injected as headers in this call if required
-
body: describes the body of the call if the method is POST. We support a limited body structure, defined in the bodyParams (key/value pairs). The bodyType describes the format and encoding of the body in the call:
- ‘form’: meaning that the content type will be application/x-www-form-urlencoded (charset UTF-8) and the key/value pairs will be serialized as is: key1=value1&key2=value2&…
- ‘json’: meaning that the content type will be application/json (charset UTF-8) and the key value pairs will be serialized as a json object as is: { “key1”: “value1”, “key2”: “value2”, …}
The definition of the way the access token must be injected in the HTTP request of the action:
-
authorizationType: defines how the generated access token must be injected in the HTTP call for the action. The possible values are:
- bearer: indicates that the access token must be injected in the Authorization header, such as: Authorization: Bearer <access token>
- header: indicates that the access token must be injected as a header, the header name defined by the property tokenTarget. For instance, if the tokenTarget is myHeader, the access token will be injected as a header as: myHeader: <access token>
- queryParam: indicates that the access token must be injected as a queryParam, the query param name defined by the property tokenTarget. For instance, if the tokenTarget is myQueryParam, the URL of the action call will be: <url>?myQueryParam=<access token>
-
tokenInResponse: indicates how to extract the access token from the authentication call. This property can be:
- ‘response’: indicates that the HTTP response is the access token
- a selector in a json (assuming that the response is a json, we don’t support other formats such as XML). The format of this selector is json://<path to the access token property>. For instance, if the response of the call is: { “access_token”: “theToken”, “timestamp”: 12323445656 }, the tokenInResponse will be: json: //access_token
The format of this authentication is:
You can change the cache duration of the token for a custom authentication data source. Below is an example of a custom authentication payload. The cache duration is defined in the “cacheDuration” parameter. It specifies the retention duration of the generated token in the cache. The unit can be milliseconds, seconds, minutes, hours, days, months, years.
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an event