Problem: trying to authenticate to a dev org using Session Id authentication and cURL fails when following the REST API Dev doc. The example in the doc provides the following, which fails (Quick Start pg:23):
curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d
"client_id=myclientid" -d "client_secret=myclientsecret" -d "mylogin@salesforce.com" -d
"password=mypassword123456"
Even after appending the security token to the password, the response is the same:
{"error":"invalid_grant","error_description":"authentication failure"}
Attribution to: Adam
Possible Suggestion/Solution #1
The documentation has a bug in it. Following the documentation, your cURL command would look like this:
curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d
"client_id=XXXXXX.YYYYY_ZZZZZ" -d "client_secret=000099990000" -d "name@domain.com" -d
"password=yourpasswordyoursecuritytoken"
It's missing the username= parameter. Change it to the following and it will work for you:
curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d
"client_id=XXXXXX.YYYYY_ZZZZZ" -d "client_secret=000099990000" -d "username=name@domain.com" -d
"password=yourpasswordyoursecuritytoken"
Attribution to: Adam
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5206