Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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"}
share|improve this question

1 Answer 1

up vote 8 down vote accepted

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"
share|improve this answer
1  
Good find. Are you aware you can report this directly to Salesforce? Here is the html version of the page At the bottom of the page there is the section: Was this information helpful?, and the link Yes, except. Where you can put all the details you have posted in this question and answer. I don't know how proactive they are with the feedback they receive, so it may get ignored. But it's better than nothing –  Daniel Blackhall Dec 9 '12 at 22:01
1  
The feedback form directly logs a case with the doc writer team, and is by far the best way to give feedback & get the docs improved. –  superfell Dec 9 '12 at 22:04
    
This is good to know. Thanks. I gave up on logging cases when they changed the rules to disallow dev orgs to file them. But I'll post this on the feedback form. –  Adam Dec 9 '12 at 22:10
    
I stubmled across this today - proof positive that the documentation hasn't been corrected in 9 months –  Καrτhικ Sep 11 '13 at 19:13
    
Too bad. I logged this on the feedback form back when it happened. This is why the StackExchange isn't going anywhere. –  Adam Sep 11 '13 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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