Bearer Auth Token not working

I have set up custom Auth for my API as shown in screenshot below:

I have defined a variable AUTHORIZATION_TOKEN in the Authorization header for the API resource and have added the second step in custom auth workflow to assign the value to the defined variable from the body of the response as shown in screenshot below:

I have tried all the following syntax when assigning value to the Variable:

 * http1.body.data.access_token
 * http1.body.token
 * http1.body.access_token
 * http1.body.token
 * http1.body.data[0]

However, when I try to build a query using this resource, I keep getting error message as shown in the screenshot below:

The API request is shown in the screenshot below:

what could I be missing or doing wrong?

(PS: I have reviewed all the online available solutions to people facing similar situation and tried to follow each step keenly to fix my issue but to no avail)

Hey @kelvin!

That can happen if the token property isn't defined on http1.body. Can you try clicking the "Test Auth Workflow" button? It should return a JSON with available properties for you to access.

Can you let me know if your token shows up there?

Hello @Kabirdas , The http1.body is defined in the JSON object returned. Kindly see attached screenshot

Thanks for that! Based on that screenshot, can you try {{ http1.body.data[0].access_token }}?

Hello @Kabirdas , still getting the same error saying ("msg": "Authorization Header must be in the form: Bearer YOUR_TOKEN") even with the changes

:thinking: would you mind sharing your API request as you did above?

Hello @Kabirdas , sorry for the confusion. I had input http1.body[0].access_token instead of http1.body.data[0].access_token but I have fixed this and its working. Thank you for your support.

1 Like