Some APIs require you to retrieve an access token from the headers of the response returned by the initial request.
For example:
- You make an initial call to a /login endpoint with your username and password to get an access token.
- Upon making that API call, you get the access token returned in the response header.
- You then use the returned access token for subsequent API requests.
The handlebar expression you create needs to return the access token. integrator.io allows you to do this in a variety of ways depending on how the access token is returned in the header.
NOTE: All of the returned response headers are set to lowercase. Because of this, all your handlebar expressions will need to reference the header field in lowercase even if you see something different within Postman.
Response header key | Response header value | Handlebar helper |
Authorization |
eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiII8P43aZQX0bdjfQ39CCiZ6ZiLWM |
{{{responseHeaders.authorization}}} |
Authorization |
Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI3MTMzZjIwNy03YmVlLTQzZiLWM |
{{{split responseHeaders.authorization ' ' 1}}} |
Comments
0 comments
Please sign in to leave a comment.