How to add OAuth2 token to http header to access Microsoft Azure services

Hello @all,

I need some help - I need to add some data to the http header -
do you have an example ? And when do I do this ?

My idea was:

   GetAccessToken;

   http := Channel as TROIndyHTTPChannel;
   http.Headers['Authorization'] := 'Bearer ' + GaToken;

   (RORemoteService as IAES32CloudAPIService).PushQS(OptionNHDAPIKey,QS,ReturnCodes);

But this does not seem to work …

Thank you,

Nils

Hi,

Can you check with CURL that your GaToken is accepted by server-side, pls?


try to set header directly to Indy client, like

http.IndyClient.Request.CustomHeaders['Authorization'] := 'Bearer ' + GaToken;