Basic Authentication to Get Token
- 15 Nov 2022
-
DarkLight
-
PDF
Basic Authentication to Get Token
- Updated on 15 Nov 2022
-
DarkLight
-
PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Scenario
This system has a two-step authentication, but instead of using a normal body to request a token, the adapter needs to use basic authentication to get the token.
This requires the following changes to be made to the endpoint configuration for the adapter in the /adapter-home-dir/entities/.system directory.
Changes to the action.json
File:
- To begin, you need to add a header to the token request. The header is added into the headers section. The header we want to send on the request is the Authorization header. Notice that in this case, since it is already defined as a header, we do not need to use header.headers.xxx). Instead, we just need to provide the name of the header. The value of the header is the format of Basic Authentication. Since this header is on the token request, the adapter library will still replace the variables and encode it (this is not normally done on header data).
action.json Example
{
"name": "getToken",
"protocol": "REST",
"method": "POST",
"entitypath": "{base_path}/{version}/authentication/login",
"requestSchema": "tokenReqSchema.json",
"responseSchema": "tokenRespSchema.json",
"timeout": 0,
"sendEmpty": false,
"requestDatatype": "JSON",
"responseDatatype": "JSON",
"headers": {
"Authorization": "Basic {b64}{username}:{password}{/b64}"
},
"responseObjects": [
{
"type": "default",
"key": "",
"mockFile": "mockdatafiles/getToken-default.json"
}
]
},
Was this article helpful?