Set an authorization header in an HTTP request


Paolo Lops

Hi David,can yoy explay me hot to set an Authentication Header in AB. The tocken is correct i have test it with other software.

Dont't works... the ip is the same of my previus emailregards Paolo


DecSoft

Hello Paolo,

You say that the above don't work, but, do you get some error message? Please, try the app by opening it in Firefox, and, press the F12 key in order to open the developer console. Then, take a look at the request, and, if you can see any error or something that we can use to find a possible solution.



Paolo Lops

Hi,

this is the error log:

for me is how if the header is not passed..


DecSoft

Hello Paolo,

If I am not wrong, the problem is related with the CORS permissions. Maybe the thirdparty server don't allows HTTP calls from client apps. If this is the problem (and I think so) you must prepare your own bridge in your own app's server. Then your app communicate with your server (who provide the right CORS permissions) and your server is responsible to communicate with the thirdparty API and provide you the right response.

You can take a look at various AB samples like SimplePost, HttpClient, etc. Take a look at the included PHP script in the samples. As you can see, that scripts setup the right CORS permissions, to allows the app to communicate with the server / scripts without problems.



Paolo Lops

Hi David, tanks for your replay.

since i use nodejs and nodered

i have chenge my settings.js in nodered path to allow

so now all works correctly.

thanks for your suggestion!


DecSoft

Hello Paolo,

Glad to know that you got it. And thanks for sharing the NodeJS configuration: may can be useful for other people too.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.