+ Start a Discussion
bakumbakum 

INVALID_LOGIN issue

Hi, I'm getting a persistent INVALID_LOGIN problem...

I am 100% sure the username and password are right.  I cut and paste them into the web login and that worked. 
The wsdl is a fresh download from this morning and it is accessible in that spot.



here's the code.  it's just a little POC for connecting to SF via PHP api and nothing is doing yet:

ini_set("soap.wsdl_cache_enabled", "0");
require_once (DIR_FS_SF_SOAP_CLIENT.'SforceEnterpriseClient.php');
require_once (DIR_FS_SF_SOAP_CLIENT.'SforceHeaderOptions.php');

try
{

   
    $mySforceConnection = new SforceEnterpriseClient ();
    $mySoapClient = $mySforceConnection->createConnection(DIR_FS_SF_SOAP_CLIENT."enterprise.wsdl.xml");
    $mylogin = $mySforceConnection->login("XXX", "YYY");

      $userResult = $mylogin->userInfo;
      print_r($userResult);
      echo $userResult->userFullName.', your session id is '.$mylogin->sessionId;

      $query = 'SELECT * FROM Opportunity';
      $response = $mySforceConnection->query(($query));

      print_r($response);

      foreach ($response->records as $record)
      {
       print_r($record);
      }

      print_r($mySforceConnection->getLastRequest());

      $bagent = $_SERVER["HTTP_USER_AGENT"];
      echo '<b>USER AGENT:</b> '.$bagent.'<br><br>';

}
catch (Exception $e)
{
  echo $e->faultstring;
}
SuperfellSuperfell
What's the associated error text that you get ?
bakumbakum
Simon,  thanks for the reply.

Test is: " INVALID_LOGIN: Invalid username or password or locked out."

The account is not locked out and both username and password are correct!

-mb
Tran ManTran Man
Is this a Developer Edition org?
bakumbakum
nope.  prod.
Alex 2.0Alex 2.0

Make sure that the account you are using to login has API access, look under Setup->Users->your user and check the API box.

--Alex

bakumbakum
Thanks for the info, Alex.  Actually, I figured this out with help from SF support.  The issue was my password had a $ in it, which is a no no on the PHP side.  Works fine as a login for SF, but when trying to pass it in a SOAP header it's not escaped propoerly, or something. 

Anyway, took the $ out and everything went fine.
IcarusMaximusIcarusMaximus
Ahhhh!! I had this same problem. Can someone post the proper way to escape non-standard characters in a SOAP login?
bakumbakum
should be a \ I think.  I been meaning to put my login back to what it was but I haven't.