[Solved] How to do basic authentication on HTTP PUT output?

#1

Hi,

I want to pass some data from Losant to an external DB, through an HTTP PUT call.
This call requires basic authentication (username, password).

How can I set this authentication in HTTP OUT parameters ? I can’t find a way to do it.

Thanks,

#2

As you probably know already, basic HTTP authentication requires passing an Authorization HTTP header, with the value of Basic (base64-encoded username:password) .

Good news! We have a Handlebars format helper that will handle the encoding part. So what you’ll need to do is, in your HTTP node, add a header with the name Authorization and the value Basic {{encodeBase64 "username:password"}}, where “username:password” is your server’s username and password separated by a colon.

#3

Works perfect (just had to use triple bracket instead of 2), we can close this one.

Thanks !!