Has anyone done basic HTTP auth request with the h...
# suitescript
c
Has anyone done basic HTTP auth request with the https module? I’m trying to request data from an API but am getting the response “This request requires HTTP authentication” even though I’m passing in the headers param. The same request works fine in postman and node:
Copy code
https.get({
    url: "<https://example_endpoint.com>",
    headers: {"Authorization": "Basic #BASE64_TOKEN_HERE#"}
});
e
Try using an array for the headers:
Copy code
var headers = [];
      headers['authorization'] = your token
b
use an echo service like https://httpbin.org to see the request its receiving
you can compare the requests postman makes to the ones from suitescript
e
Don’t you have to use the SecureString functions when doing this now? https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4418229131.html
See the section “Create an Authentication Header using a SecureString”
294 Views