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
Beatriz RamírezBeatriz Ramírez 

How could Obtaining Access Token using cURL with SSO ON for bulk api?

Saurabh BSaurabh B
Hi Beatriz,
Below are the steps,

1 ) Create a .txt file on your C drive ( C: ) with text below and name it as "soaplogin"
2 ) Replace Username and Password + token at line 6 and 7
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <n1:login xmlns:n1="urn:partner.soap.sforce.com">
	<n1:username>username@hotmail.com</n1:username>
      <n1:password>password_with_security_token</n1:password>
    </n1:login>
  </env:Body>
</env:Envelope>
3) After you create above file, call that file using cURL with below code (please make sure you are calling it on C: or whatever drive you have create a txt file on),
 
curl https://login.salesforce.com/services/Soap/u/36.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @soaplogin.txt
After step 3, server will return your Access Token....

Hope this helps!

Please mark this as Best Answer if it helps you!

 
Beatriz RamírezBeatriz Ramírez
Thanks to reply Saurabh B !!!

I followed all the steps but I got an error.

I'm sure that I used the right token, but I have a doubt if the error is because of the Single Sing On is enable and I will have to use another property,

The instance that I try to log in is a custom instance.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:sf="urn:fault.partner.soap.sforce.com" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body><soapenv:Fault>
<faultcode>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>
</soapenv:Body>
</soapenv:Envelope>