I’m having trouble with basic authentication using the nlapiRequestURLWithCredentials function. I’m not exactly sure if I should be using nlobjCredentialBuilder or not, I’ve seen it documented both with and without and tried both with no luck. Has anyone been able to connect to an API using basic authentication?
Code:
var url = ‘https://m.g.com/’;
var uname = ‘username’;
var pwd = ”;
var creds = [uname, pwd];
var headers = [‘content-type’, ‘application/json’];
var response = nlapiRequestURLWithCredentials(creds, url, null, headers, ‘GET’);
This is a cached copy. Click here to see the original post.