Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INVALID_LOGIN_CREDENTIALS error on NetSuite, but correct credentials

Tags:

netsuite

I've been trying to use the NetSuite api for sometime using the netsuite gem.

I can login to the website, but when I try to authenticate from the API I get an INVALID_LOGIN_CREDENTIALS error.

This is the payload of the request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2011_1.platform.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:platformCore="urn:core_2011_1.platform.webservices.netsuite.com">
  <env:Header>
    <platformMsgs:passport>
      <platformCore:email>[email protected]</platformCore:email>
      <platformCore:password>--snip--</platformCore:password>
      <platformCore:account>ACCOUNTNO</platformCore:account>
      <platformCore:role type="role" internalId="ROLE"/>
    </platformMsgs:passport>
  </env:Header>
  <env:Body>
    <platformMsgs:get>
      <platformMsgs:baseRef xsi:type="platformCore:RecordRef" internalId="4" type="customer"/>
    </platformMsgs:get>
  </env:Body>
</env:Envelope>

This is the payload of the response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>You have entered an invalid email address or account number. Please try again.</faultstring>
      <detail>
        <platformFaults:invalidCredentialsFault xmlns:platformFaults="urn:faults_2011_1.platform.webservices.netsuite.com">
          <platformFaults:code>INVALID_LOGIN_CREDENTIALS</platformFaults:code>
          <platformFaults:message>You have entered an invalid email address or account number. Please try again.</platformFaults:message>
        </platformFaults:invalidCredentialsFault>
        <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">sb-partners-java002.svale.netledger.com</ns1:hostname>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
like image 440
Bruno Buccolo Avatar asked Dec 26 '22 15:12

Bruno Buccolo


1 Answers

I've just solved the issue. If you're having trouble make sure that:

  • You are connecting to the right environment. (non-sandbox vs sandbox)
  • Your user (or your role) have WebServices permission (see in Permissions > Setup)

I faced both of the issues. My account, even belonging to an Administrator role, lacked Web Services permission. And I was using the sandbox url to a non-sandbox account.

  • https://webservices.na1.netsuite.com/wsdl/v2012_1_0/netsuite.wsdl (non-sandbox)
  • https://webservices.sandbox.netsuite.com/wsdl/v2012_1_0/netsuite.wsdl (sandbox)
like image 127
Bruno Buccolo Avatar answered Jan 21 '23 14:01

Bruno Buccolo