function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tu DaoTu Dao 

Issue with Force.com Migration Tool

Hi guys,

 

When I used Force.com Migration tool to retrieve metadata from a developer org, I got this error : 

Invalid username, password, security token; or user locked out.

 

After checking the configuration, I'm sure that : 

- The username, password & security token are correct because I can use them to checkout a Force.com project in Eclipse.

- Server url is correct (https://login.salesforce.com)

 

Can anybody give me an advice ?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Tu DaoTu Dao

Thanks Ankit.

 

That's exactly what I did but it didn't work.Here's my configuration 

 

build.properties

sf.username = tdao@92demo.com
sf.password = MYPASSWORDrZ4SUBTPbxXX0GbvbOitKtwU
sf.serverurl = https://login.salesforce.com

 build.xml

    <target name="retrieveUnpackaged">
      <mkdir dir="retrieveUnpackaged"/>
      <sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
    </target>

 package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <version>24.0</version>
</Package>

 Result

H:\Projects\DataMigration\sample>ant -verbose retrieveUnpackaged
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Trying the default build file: build.xml
Buildfile: H:\Projects\DataMigration\sample\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_24\jre
Detected OS: Windows 7
parsing buildfile H:\Projects\DataMigration\sample\build.xml with URI = file:/H:/Projects/DataMigration/sample/build.xml
Project base dir set to: H:\Projects\DataMigration\sample
parsing buildfile jar:file:/G:/SoftHost/apache-ant-1.6.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/G:/SoftHost/apach
e-ant-1.6.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading H:\Projects\DataMigration\sample\build.properties
 [property] Loading Environment env.
Build sequence for target(s) `retrieveUnpackaged' is [retrieveUnpackaged]
Complete build sequence is [retrieveUnpackaged, listMetadata, deployCode, deployCodeFailingTest, retrieveCode, deployCodeCheckOnly, retrieve
Pkg, bulkRetrieve, describeMetadata, test, deployUnpackaged, undeployCode, deployZip, ]

retrieveUnpackaged:
    [mkdir] Skipping H:\Projects\DataMigration\sample\retrieveUnpackaged because it already exists.
parsing buildfile jar:file:/G:/SoftHost/apache-ant-1.6.5/lib/ant-salesforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/G:/SoftHost/
apache-ant-1.6.5/lib/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip file

BUILD FAILED
H:\Projects\DataMigration\sample\build.xml:20: Invalid username, password, security token; or user locked out.
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:215)
        at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java:248)
        at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRunner.java:16)
        at com.salesforce.ant.RetrieveTask.execute(RetrieveTask.java:110)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: [LoginFault [ApiFault  exceptionCode='INVALID_LOGIN'
 exceptionMessage='Invalid username, password, security token; or user locked out.'
Do you know what I'm doing wrong ?

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

To login from this IP Address, you need to supply your API Security Token, as well as your password. When accessing Salesforce--either via a desktop client or the API--from outside of your company’s trusted networks, you must add a security token to your password to log in. To receive a new security token, log in to Salesforce at http://www.salesforce.com and click Setup -> My Personal Information -> Reset Security Token.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Tu DaoTu Dao

Thanks Ankit.

 

That's exactly what I did but it didn't work.Here's my configuration 

 

build.properties

sf.username = tdao@92demo.com
sf.password = MYPASSWORDrZ4SUBTPbxXX0GbvbOitKtwU
sf.serverurl = https://login.salesforce.com

 build.xml

    <target name="retrieveUnpackaged">
      <mkdir dir="retrieveUnpackaged"/>
      <sf:retrieve username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
    </target>

 package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <version>24.0</version>
</Package>

 Result

H:\Projects\DataMigration\sample>ant -verbose retrieveUnpackaged
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Trying the default build file: build.xml
Buildfile: H:\Projects\DataMigration\sample\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_24\jre
Detected OS: Windows 7
parsing buildfile H:\Projects\DataMigration\sample\build.xml with URI = file:/H:/Projects/DataMigration/sample/build.xml
Project base dir set to: H:\Projects\DataMigration\sample
parsing buildfile jar:file:/G:/SoftHost/apache-ant-1.6.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/G:/SoftHost/apach
e-ant-1.6.5/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading H:\Projects\DataMigration\sample\build.properties
 [property] Loading Environment env.
Build sequence for target(s) `retrieveUnpackaged' is [retrieveUnpackaged]
Complete build sequence is [retrieveUnpackaged, listMetadata, deployCode, deployCodeFailingTest, retrieveCode, deployCodeCheckOnly, retrieve
Pkg, bulkRetrieve, describeMetadata, test, deployUnpackaged, undeployCode, deployZip, ]

retrieveUnpackaged:
    [mkdir] Skipping H:\Projects\DataMigration\sample\retrieveUnpackaged because it already exists.
parsing buildfile jar:file:/G:/SoftHost/apache-ant-1.6.5/lib/ant-salesforce.jar!/com/salesforce/antlib.xml with URI = jar:file:/G:/SoftHost/
apache-ant-1.6.5/lib/ant-salesforce.jar!/com/salesforce/antlib.xml from a zip file

BUILD FAILED
H:\Projects\DataMigration\sample\build.xml:20: Invalid username, password, security token; or user locked out.
        at com.salesforce.ant.SFDCAntTask.doLogin(SFDCAntTask.java:215)
        at com.salesforce.ant.SFDCAntTask.getMetadataConnection(SFDCAntTask.java:248)
        at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRunner.java:16)
        at com.salesforce.ant.RetrieveTask.execute(RetrieveTask.java:110)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: [LoginFault [ApiFault  exceptionCode='INVALID_LOGIN'
 exceptionMessage='Invalid username, password, security token; or user locked out.'
Do you know what I'm doing wrong ?
This was selected as the best answer
Ken0624700Ken0624700

Not sure if you've figured out the solution yet - I ran into similar situation and it turned out that if my password contains $ signs the ant migration tool mistakenly truncates it, thinking that it's part of the token expression (${}). After I added an extra $ sign to my password it begins to work. Better yet, just avoid having $ signs in your password altogether!

Tu DaoTu Dao

Thanks Ken. It works like a charm :)

n_pavan_kumar1n_pavan_kumar1
Hi Ken,

Thank you so much. I had the same issue where my password had $ sign where in ANT migration tool it was not working it was saying as Invalid username, password, security token; or user locked out. But the same password did work on Eclipse and other. By reading your comment I did change my password by excluding the $ sign and tried connecting again through ANT tool and it worked successfully. I did all circus by clearing my temp folder, restarting my machine, nothing helped. But your solution really helped in time. Thank you so much.

Thanks,
Pavan
sujithkumar j 9sujithkumar j 9
HI,

My password didnot contain any $ Symbol.But i am facing the same problem.Can any one give advise?



Thanks

 
Dan WarrenDan Warren

Hi, I am experiencing the same problem:

I'm using Windows 10
Attempting to use the example describeMetadata target with a Developer Edition.

sf.serverurl = https://login.salesforce.com

Password and Security Token are correct (can login with MavensMate)
Not connecting via a Proxy (as far as I can tell)

The failed login attempts do NOT show in the login attempts for my user.

any help would be appreciated, thanks.