INVALID_LOGIN: Invalid username, password, security token - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Jesus VazquezJesus Vazquez 

INVALID_LOGIN: Invalid username, password, security token

I am using the API for WSDL when using the Login method gives me the error, "INVALID_LOGIN: Invalid username, password, security token, or user locked out."
I checked the credentials that do the login and are correct, and the Password I add the "Security Token" but I still throwing that error.
The account I do the login is a "Developer Edition"

Thanks in advance
Best Answer chosen by Jayson (salesforce.com) 
Randal PintoRandal Pinto
Hey everyone, banged my head for a couple of hours to find a solution so thought I should share. It seems that if you have previously created a password and security token then go on to generate the WSDL file this password will not give you access to the SOAP API. You have to reset both the password and the security token (in this order) to grant that user access to SOAP APIs.

All Answers

Johan YuJohan Yu
can you login using the same username and password via web browser to login.salesforce.com ?
Jesus VazquezJesus Vazquez
Yes, I put in the browser,
username = myuser@company.com
Password = mypassword
and I loggin correctly
By using the Api put
username = myuser@company.com
Password = mypasswordXXXXXXX
where "XXXXXXX" is the security token,
This is where Error shows
Johan YuJohan Yu
Add security token after passwod if login via API
see here
http://na3.salesforce.com/help/doc/en/user_security_token.htm
Johan YuJohan Yu
I am going off, best of luck.
Maria BelliMaria Belli
Have you reset your security token? You might be tryingn to use an old token.. just a guess anyways.
Johan YuJohan Yu
Do you get login to salesforce from API?
Let us know if can help.
Jesus VazquezJesus Vazquez
Hi, I reset my Security Token but still do not let me loggin,
I keep checking the same error.
I generated the WSDL file for the company in the Development-> API,
this file I'm using to connect to the API,
I'm using JackBe Presto platform in which I set high this WSDL.
Jesus VazquezJesus Vazquez
I am using login.salesforce.com for loggin or should I do it test.salesforce.com?
Johan YuJohan Yu
try to use Apex Data Loader to login just to make sure the password + security token is correct.
Maria BelliMaria Belli
Depends on if you are logging into production (login.salesforce.com) or sandbox (test.salesforce.com).
Johan YuJohan Yu
login.salesforce.com for production instance
test.salesforce.com for sandbox instance
Maria BelliMaria Belli
You did say developer edition so it would be login.salesforce.com.
Jesus VazquezJesus Vazquez
I Use the Apex data loader to verify the login and does it well
Johan YuJohan Yu
Yes, login.salesforce.com is the correct end-point for developer edition
Maria BelliMaria Belli
Can you check your login history to see if a login attempt from your API is in there (Manage Users > Login History)? If it's not there, it's not hitting your instance for some other reason.
Jesus VazquezJesus Vazquez
I checked the loggin Attempt and shows me:
Logon Type: API only networking portal
Status: Invalid Login
Api Type: SOAP Enterprise
Johan YuJohan Yu
Where do you see that error?
Can you test from Apex Data Loader?
Are you sure the security token is valid?
You can reset your security token from My Personal Information menu
Jesus VazquezJesus Vazquez
Hi, I'm using a tool called JackBe Presto in which I have discharged the enterprise WSDL.
When checking in "Users> Login History" is the call to SalesForce but shows the following information:
Logon Type: API only networking site
Status: Invalid Login.
I did a test with the Apex Data Loader and has successfully loggin with valid security token.
Maria BelliMaria Belli
Not sure if any of the information in this post is helpful or not but worth reviewing:

http://mdc.jackbe.com/enterprise-mashup/blog/simplify-salesforcecom-api-using-presto
Jesus VazquezJesus Vazquez
Actually I'm using this tutorial but when I click on "Run" show me the error, Invalid username, password, security token, or user locked out.
Maria BelliMaria Belli
Perhaps you can post the code? Just be sure to change the username/pw values so it's not made public.
Jesus VazquezJesus Vazquez
This Error Shows me when I clic on "Run"

This error shows me when clic on "Run"
Johan YuJohan Yu
Have you check the login history, do you see any error there when you run the code in JackBe Presto (I do not know this tool).
Jesus VazquezJesus Vazquez
Yes, I checked the loggin Attempt and shows me:
Logon TypeAPI only networking portal
Status: Invalid Login
Api TypeSOAP Enterprise
The request if made login.salesforce.com but can not be authenticated, shows, invalid loggin
Johan YuJohan Yu
I never see this issue before using any API tool to login, if you can login with Apex Data Loader, you should be able to login with any API tool. Anyway, have you try SoapUI?
Jesus VazquezJesus Vazquez
I downloaded SoapUI and tried my credentials and work well.
And show my sessionId, UserId, etc.
In login attempt shows "Other Apex API" an correct Login.
I do not know why my data does not show the login from JackBe Presto, from other applications if you make the connection correctly.
Johan YuJohan Yu
So, we can say the issue is with JackBe Presto, as the login is working with SoapUI and Apex Data Loader.
Jesus VazquezJesus Vazquez
Yes, because I tried in several ways and not make the connection.
If the request arrives to salesforce when I run the code JackBe Presto,
but in the login attempt in Salesforce shows Invalid Login.

Maria BelliMaria Belli
You probably have a few other options at this point. One would be to see if there are any user boards for Jack Be Presto and try reaching out to someone there. Other option would be to post this question out on one of the developer related boards as they may have some knowledge surrounding this app:

http://salesforce.stackexchange.com/

or

http://boards.developerforce.com/sforce/?category.id=developers

Good luck!
Johan YuJohan Yu
What kind of wsdl you use?
Do you download it directly from salesforce.com?
Do you modify it?

there is some discussion here maybe similiar with yours, best of luck.
http://salesforce.stackexchange.com/questions/4159/cant-log-user-in-on-soap-api
Jesus VazquezJesus Vazquez
I downloaded the WSDL option Salesforce Development -> API, enterprise.wsdl, this WSDL is an XML which has methods for querying the API.
Within JackBe Presto platform loads the WSDL file,
This file will not make any changes
Santosh DuvvuriSantosh Duvvuri
Hi All,
If you are trying loging using soupui, then request must be somthing like this

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:LoginScopeHeader>
      </urn:LoginScopeHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>${#Project#username}</urn:username>
         <urn:password>${#Project#password}</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

********************************************************************

Note we should not provide <urn:organizationId>?</urn:organizationId> in the header.
Jan RehorikJan Rehorik

Santosh Duvvuri answer worked for me with the same situation.
srinivasarao Muppanenisrinivasarao Muppaneni
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>userid</urn:username>
         <urn:password>pwd</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

Iam unable to loginto salesforce
srinivasarao Muppanenisrinivasarao Muppaneni

      <soapenv:Fault>
         <faultcode>sf:INVALID_LOGIN</faultcode>
         <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
         <detail>
            <sf:LoginFault xsi:type="sf:LoginFault">
               <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
               <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
            </sf:LoginFault>
         </detail>
      </soapenv:Fault
Juan MaartJuan Maart
Hi everyone
We have the same issue and have reset the user password and the security token a few times but still get the same error message. Nothing on our website has changed but our generic account used to access SF from the website had to have a password reset. Since then we have been getting the message "Invalid username, password, security token; or user locked out".
srinivasarao Muppanenisrinivasarao Muppaneni
Iwas able ti login through browser
Kumar SuneelKumar Suneel
Hi All,
If username,password,security token everything is right,Can u check the version of endpoint url in wsdl?  foe example here 40.0 is version(<soap:address location="https://login.salesforce.com/services/Soap/c/40.0/)
Tomer NoyTomer Noy

Hi everyone,
I am using the API for WSDL and got the same INVALID_LOGIN with the exception message of "Invalid username, password, security token; or user locked out". I did all the above solution suggestions without success - and unfortunately this discussion was interrupted in the middle. I and my partner develop salesforce app as part as our final project at college and we would appreciate help with this issue.

Regards, Tomer

madhu vamsimadhu vamsi
Hi,
change this 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:LoginScopeHeader>
         <urn:organizationId>?</urn:organizationId>
         <!--Optional:-->
         <urn:portalId>?</urn:portalId>
      </urn:LoginScopeHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>xxxxx</urn:username>
         <urn:password>xxxxxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>



to 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>xxxxx</urn:username>
         <urn:password>xxxxxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

now it will work for sure
ketan vinodrai mehtaketan vinodrai mehta
Hi All, 
    My response may be late in this blog but it may help someone in future.    
I had same INVALID_LOGIN issue from SOAPUI tool even though my username, pwd and security token were correct. I was able to login through dataloader but not from SOAPUI. With multiple failed trials, I removed the urn:organizationId tag from my login request header and it worked for me. 
Asmita MehtaAsmita Mehta
Kindly remove   complete <urn:LoginScopeHeader> tag from SOAPUI
It worked for me.
JEETESH BAHUGUNAJEETESH BAHUGUNA
Guys, 

If you are connecting to sandbox use
https://test.salesforce.com/services/Soap/u/43
or if you are connecting prod use
https://login.salesforce.com/services/Soap/u/43
Randal PintoRandal Pinto
Hey everyone, banged my head for a couple of hours to find a solution so thought I should share. It seems that if you have previously created a password and security token then go on to generate the WSDL file this password will not give you access to the SOAP API. You have to reset both the password and the security token (in this order) to grant that user access to SOAP APIs.
This was selected as the best answer
Sudheer Kumar GandhamSudheer Kumar Gandham
@Randal Pinto: Thanks you saved couple of hours for me too....