This topic contains 1 reply, has 0 voices, and was last updated by chanarbon 7 years, 11 months ago.

  • Author
    Posts
  • #6190 Score: 0

    jmessersmith
    • Contributions: 0
    • Level 1

    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.

  • #6191 Score: 0

    chanarbon
    • Contributions: 0
    • Level 1

    Hi Jason,

    Here’s a quick workaround on this concern. If you check https://www.httpwatch.com/httpgallery/authentication/, Basic Authentication would be base64(unameassword). You can just have nlapiRequestURL() and add an Authorization header with Basic authentication as the Authentication type. Please let me know if that works for your end.

You must be logged in to reply to this topic.