For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Open sourceSupportFAQsDocs Home
  • Introduction
    • Overview
    • Retired adapters
      • Overview
        • Overview
          • Basic auth to get a token
          • Handle cookie-based tokens
          • Different host
          • Dynamic token per domain
          • Dynamic user per request
          • Encoding request values
          • Changing data types
        • Advanced authentication
      • SSL/TLS
      • Throttling
      • Headers
      • Add dynamic headers
      • Add query parameters
      • Update adapter configuration
LogoLogo
Open sourceSupportFAQsDocs Home
On this page
  • Configuration
  • action.json
ConfigureAuthenticationPatterns

Basic authentication to get a token

Was this page helpful?
Previous

Handle cookie-based tokens

Next
Built with

This system uses a two-step authentication flow. However, instead of sending credentials in the request body, the initial token request requires credentials via basic authentication in the Authorization header.

Configuration

This scenario requires a change to action.json in the endpoint configuration at /adapter-home-dir/entities/.system. No changes are required to the service instance configuration or the schemas.

action.json

Add an Authorization header to the getToken action. Because this header is defined directly in the headers object (not via auth_field), the adapter library will still substitute the {username} and {password} variables and apply base64 encoding when the token request is made.

1{
2 "name": "getToken",
3 "protocol": "REST",
4 "method": "POST",
5 "entitypath": "{base_path}/{version}/authentication/login",
6 "requestSchema": "tokenReqSchema.json",
7 "responseSchema": "tokenRespSchema.json",
8 "timeout": 0,
9 "sendEmpty": false,
10 "requestDatatype": "JSON",
11 "responseDatatype": "JSON",
12 "headers": {
13 "Authorization": "Basic {b64}{username}:{password}{/b64}"
14 },
15 "responseObjects": [
16 {
17 "type": "default",
18 "key": "",
19 "mockFile": "mockdatafiles/getToken-default.json"
20 }
21 ]
22}