> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Basic authentication to get a token

> How to configure a two-step token flow where the initial token request uses basic authentication in the request header instead of a body payload.

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.

```json
{
  "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"
    }
  ]
}
```