2

GUI

On my Windows machine, I can login with GUI Data Loader 44.0.0 without providing a username and password, by choosing "OAuth" and "Production" environment and clicking "Log in":

Login screen 1/3

On the little popup that appears, I click the bottom link "utiliser un domaine personnalisé" which is the French translation for "Use custom domain":

Login screen 2/3

I enter the custom domain name, and see the https://xxxxx.my.salesforce.com URL displaying below the field:

Login screen 3/3

And I am logged in without any issue or password entry --> "Login successful".

CLI

Now for command-line login, I can't get the same behavior. On the same Windows machine, I have tried several configurations but found none that lets me get rid of user name and password entry.

  • process-conf.xml with correct values provided in sfdc.username and sfdc.password (encrypted) works perfectly
  • process-conf.xml with no value provided in sfdc.username end systematically in error:
2020-04-08 15:38:22,614 ERROR [myProcess] client.ClientBase getConnectorConfig (ClientBase.java:112) - Empty salesforce.com username specified.  Please make sure that parameter sfdc.username is set to correct username.
  • process-conf.xml with sfdc.username provided but nothing in sfdc.password always ends in invalid login error, whatever other values I can put in the config file:
2020-04-08 15:37:28,943 ERROR [myProcess] client.PartnerClient runOperation (PartnerClient.java:350) - Error while calling web service operation: login, error was:
[LoginFault [ApiFault  exceptionCode='INVALID_LOGIN'
 exceptionMessage='Invalid username, password, security token; or user locked out.'
 extendedErrorDetails='{[0]}'
]
]

Well, you have the big picture. Details follow.

Command line

java -cp "C:\Program Files (x86)\salesforce.com\Data Loader\dataloader-44.0.0-uber.jar" -Dsalesforce.config.dir=<my conf dir> com.salesforce.dataloader.process.ProcessRunner process.name=myProcess

I have a 100% confidence that there is no problem in touching the right configuration files, here they are:

config.properties

#Loader Config
#Thu Sep 10 09:37:47 PDT 2009
sfdc.endpoint=https\://login.salesforce.com
loader.hideWelcome=true

sfdc.oauth.environment=Production
sfdc.oauth.environments=Production,Sandbox
sfdc.oauth.Production.bulk.clientid=DataLoaderBulkUI/
sfdc.oauth.Production.partner.clientid=DataLoaderPartnerUI/
sfdc.oauth.Production.server=https://login.salesforce.com/
sfdc.oauth.Production.redirecturi=https://login.salesforce.com/services/oauth2/success
sfdc.oauth.Sandbox.bulk.clientid=DataLoaderBulkUI/
sfdc.oauth.Sandbox.partner.clientid=DataLoaderPartnerUI/
sfdc.oauth.Sandbox.server=https://test.salesforce.com/
sfdc.oauth.Sandbox.redirecturi=https://test.salesforce.com/services/oauth2/success

process-conf.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="myProcess"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
        <description>Demonstration sample for StackExchange</description>
        <property name="name" value="myProcess"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.username" value="myUser"/>
                <entry key="sfdc.password" value="89f5be1b76f7e2d7bc58d8f68bb574e02a57f06b9ab9994a1811a05a0934f9aa"/>
                <entry key="process.encryptionKeyFile" value="C:\testdl\key.key"/>

                <entry key="sfdc.timeoutSecs" value="540"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="InfoQualif__c"/>
                <entry key="process.operation" value="update"/>
                <entry key="process.mappingFile" value="C:\testdl\update_icf.sdl"/>
                <entry key="process.outputError" value="C:\testdl\icftest_error.csv"/>
                <entry key="process.outputSuccess" value="C:\testdl\icftest_success.csv"/>
                <entry key="dataAccess.name" value="C:\testdl\icftest.csv" />
                <entry key="dataAccess.type" value="csvRead" />
            </map>
        </property>
    </bean>
</beans>

This sample works fine, as there is a user/password in it. the challenge is to find the keys that would allow me to remove user and password.

Update

The web browser used by GUI to ask me the custom domain is IE, as you can see here:

Right-click on custom domain window, click properties: it's IE

Even after clearing all cookies from IE (see below), I still can successfully log in with just entering my custom domain. No user name or password needed.

Clear cookies from IE

  • As far as I can research, dataloader cli doesn't support oauth. GUI does because it implemented that flow. CLI could implement the oauth process by prompting to launch a url and obtaining the oauth token but not done so far. Btw, our product Realfire provides dataloder capabilities with oauth flow so it will work in sfdc sso environments. – realfire Apr 17 at 1:57
  • Hi @Ryierth, you can load data with SFDX after OAuth2 authentication : developer.salesforce.com/docs/… – altius_rup May 24 at 5:31
0

Generally, authentication to salesforce always requires at least username,password (the example you provide above is using single sign on, via oAuth, which in this case uses username and password in a salesforce login page). Tying auth to a user ensures that the sf Admin can control user profile settings, and object access. Generally, only when using some kind of JWT token within an SSO process (JWT is not supported by dataloader), can you skip password. (for a broader understanding of how many different ways auth is possible in single sign on scenerios, see this help file: https://help.salesforce.com/articleView?id=remoteaccess_oauth_flows.htm&type=5)

However, Dataloader requires username password. Dataloader also offers username/password encryption options. Will that help you meet your business requirements (perhaps security is your concern?)

https://help.salesforce.com/articleView?id=loader_encryption.htm&type=5

You could also use a different tool which supports a different kind of auth.

This could be a good lead: since SFDX support oAuth, as well as subsequent alls without storing the username/password, try looking into the SFDX force:data CLI commands... https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_data.htm

Here is a related post: Can I use SalesforceDX to load data into sandboxes?

| improve this answer | |
  • Thank you for your answer, but it is based on an assertion that is contradicted by my case: "Generally, only when using some kind of JWT token within an SSO process (JWT is not supported by dataloader), can you skip password." --> then how is it possible that I can login with the Data Loader GUI without entering a username and password? Just by providing the proper custom domain xxxxx for https://xxxxx.my.salesforce.com it works fine. – Ryierth Apr 9 at 7:14
  • When you entered the domain, and if sfdc lets you login without entering username/password, there are two possibilities. If sfdc is sso enabled, then it is negotiating automatically with your provider. Or it is reusing the session from earlier login. Clear all cookies and try again, and it will prompt for username/password. – realfire Apr 17 at 1:55
  • @realfire cookies from which browser? – Ryierth Apr 17 at 6:24
  • Whichever the browser which showed the window where prompts you to chose the domain. – realfire Apr 17 at 6:44
  • It was IE. Your answer made me aware that this "custom domain" window was not Data Loader's, but instead a web browser window. Anyway: I cleared everything from IE (cookies, passwords, history), then restarted Data Loader, entered my custom domain, and got logged in successfully without entering user name or password. I will update the question with this attempt, to let people know. – Ryierth Apr 17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.