Pass API token and password within the standard HTTP Authorization header

Moderator: Support

jdb136623
Posts: 1
Joined: Wed Mar 10, 2021 6:09 pm

Pass API token and password within the standard HTTP Authorization header

Post by jdb136623 »

I'm looking to set up a two-part process: a rest service that generates an API Token and then a second that uses the token and password linked to it to authenticate subsequent API calls. The documentation tells me that the API looks for the API token and password within the standard HTTP Authorization header. The Authorization header must have the scheme set to Basic and include a Base64 Encoded string of <API Token>:<Password>.

The token generation part is working fine, but I can't get the second part to operate, just returns a 401 error response. The screenshots show how I'm attempting this but it may well not be the right approach.

Can anyone point a relative newbie in the right direction here?

Many thanks
J

Attachments
Screenshot 2021-03-10 at 18.25.33.jpg
Screenshot 2021-03-10 at 18.25.33.jpg (119.65 KiB) Viewed 1101 times
Screenshot 2021-03-10 at 18.25.11.jpg
Screenshot 2021-03-10 at 18.25.11.jpg (141.33 KiB) Viewed 1101 times
Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Re: Pass API token and password within the standard HTTP Authorization header

Post by Serhii Kulibaba »

Hello,

It seems you have to include the Script component between these two REST calls: https://docs.appery.io/docs/apiexpress- ... -component

  1. In this script you can create a correct header parameter

  2. The response from the previous component is available in the variable "BODY" in the next component. You can check it with the Script pretty easily.

Post Reply