Handle cookie-based tokens
Handle cookie-based tokens
This system uses two-step authentication, but instead of returning the token in the response body it returns it in a cookie — the same way a browser session would work. Subsequent requests must also send the token as a cookie. Additionally, the token request requires an Accept: */* header, and the response is not JSON.
Configuration
This scenario requires changes to the service instance configuration, action.json, and the response schema.
Service instance configuration
Update auth_field and auth_field_format in the authentication section so the token is placed in the Cookie header on subsequent requests.
action.json
Set responseDatatype to PLAIN since the token response is not JSON. Add an Accept: */* header to override the adapter library’s default Accept header.
Response schema
Add a placement field set to "header" on the token property to tell the adapter library to look for the token in the response headers rather than the body. Set external_name to the specific header field that contains the cookie value.