Salesforce | [message:protected] => INVALID_LOGIN: Invalid username, password, security token; or user locked out

Author - Kiran Preet

While upserting records using SFDC php API we were facing following exception :

[message:protected] => INVALID_LOGIN: Invalid username, password, security token; or user locked out.

This exception was showing up frequently when we were upserting records using PHP API. The username, password and security token which we were using were correct but still we were facing this exception. Eventually we found that the ip address from which we were running the code was not added as Trusted Ip inside Salesforce security settings.

So we followed these steps to solve it :

1. Login to Salesforce org.

2. Click on Setup :

3. Open Security Controls on left side and click Network Access link :

4. Click New button to add new ip address/range :

5. Add the IP address of your machine from which you are upserting records. If you have a static IP address put your IP address in the start IP address box and same IP address in the end IP address box as shown below :

If you have a range of IP addresses, put start IP address and end IP address and then click on save. It will resolve this exception.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published.