Hi,
We have a network server sending data into our Losant applications using Webhooks.
We have a number of webhooks working into this particular application OK.
When adding a new one, I am getting “Authorization Required” error messages:
“err”:{“message”:“Request failed with status code 401”,“code”:“ERR_BAD_REQUEST”,“responseStatusCode”:401,“responseData”:{“error”:“Authorization Required”}}
I am using an excel template to generate my Base64 and Basic headers, which is working for other webhooks, but not for this one. (Method is the same)
I’ve also attempted to create 2 or 3 new ones, deleted and recreated Webhook input nodes, with no success.
Could there be some kind of bug, limit or restriction happening?
I can share application ID’s over PM.
The first thing I recommend is to invoke the webhook directly. You can do so using tools like Postman or from your local terminal using curl:
curl -u myUser:myPass -d '{"hello":"world"}' -H "Content-Type: application/json" -X POST https://triggers.losant.com/webhooks/YOUR_ID
I created a test webhook with basic auth configured. When invoked directly, I do correctly see the successful result:
{ "success": true }
If you see the webhook work when invoking it directly, that points to some issue with your basic auth credentials. To test exactly what the network server is sending, you can point the network server to a service like PostBin. These services display the full details for web requests to help debug what was sent (for PostBin specifically, you have to refresh the page after each request to see the details).
For example, when invoking PostBin, this is what I see:
You can then decode the Base64 using a service like base64decode.org to verify the user name and password are correct:
Let me know what you find!
1 Like
Thanks for the support Brandon.
Your test method proved that Losant’s webhook was working OK.
We investigated further on our network server and found that something strange was happening with our longform username/password. (Even though this is working on other webhook integrations). By shortening these the authentication started to work and data is flowing.