Bearer Token Authorization issue with RESTFul API from Ensemble REST Operation EnsLib.REST.Operation
Hi dev community,
I am currently working on a project to send documents to a RESTful based API that supports bearer
Token Authorization.
When we try to fire a JSON request from our EnsLib.Rest.Operation towards the 3rd party API with a
valid Token we keep receiving Authorization Error codes HTTP 401 back.
If we use the same request and same Token from a test utility such as Postman the request is
successful and we are able to move past the authorization stage.
We are inputting the Token in the header of the HTTP request as specified by the 3rd party API
specification. We therefore are using the following code from the operation side, being tHttpRequest a %Net.HttpRequest object:
set tSC = tHttpRequest.SetHeader("Authorization","Bearer "_$ZSTRIP(pRequest.Token,"<>W"))
We can see below the token in the HTTP header that is being fired towards the API:
HTTP HEADER:
User-Agent: Mozilla/4.0 (compatible; Cache;)
Host: localhost
Accept-Encoding: gzip
Authorization: Bearer
Khoqt0CHmlbolPd2OAxtroUCQXlLCg-1U8zM9XyuutxwHA8ZCkS-uDuv9SMD0SZX9Eut-KOopyQqwjsx7MLgvGo9s4_LXDyCTzKd
hEqkUubEGJqyACnCc2qGUC8Arm7NYC05qLX6irvXgfPoqJNr9qz_ZK0Iaq4b3M92wgCgYP4_0MZZCAq-F1yDlI_jENOxIuseRuq7
KuDDlTy6fOl3EMBSjR4k-heTTO4vjSyGklOTTXNamql4fd8sRigPVkRP7Vgh4vosn96K9A9xmw-GqrIu_dJqa-1hrzMFp47jIBpF
JQaLfYiKsPvPJAswjCViCVIpDh6-J8LzV7iAhX9yYQ
The question is if we might be missing something in order to set up the EnsLib.Rest.Operation to use Bearer token
Authorization and whether there is any workaround.
Kind Regards,