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
Dave ChisholmDave Chisholm 

invalid_grant and other API woes

I have been trying to setup API access to our developer account for two days.   I have followed all the instructions in the SF docs, as well as the much better guide available here: 
http://www.calvinfroedge.com/salesforce-how-to-generate-api-credentials/

Saddly I get the dreaded and useless error message "invalid_grant Authentication Failure".

curl -v https://test.salesforce.com/services/oauth2/token
-d "grant_type=password"
-d "client_id=3MVG9KsVcz....dM0zQJdDGEpp"  
-d "client_secret=599....83973"  
-d "username=dave@xxxx.com"
-d "password=<password><user security token>"

Other settings:
- Enable OAuth Settings YES
- Selected Scopes "Full Access"
- Permitted Users    "All users may self-authorize"
- IP Relaxation    Relax IP restrictions

What else am I missing?  And why are these settings spread out on so many different screens?

 


 

Best Answer chosen by Dave Chisholm
Dave ChisholmDave Chisholm

OMG!  At long last!   

Please FIX this page:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_oauth_endpoints.htm

https://test.salesforce.com/services/oauth2/token 
is NOT the end point to use, and the error message actually lulls you into thinking that you are knocking on the right door.

Use your developer account domain instead: Which is something like

https://naxx.salesforce.com/services/oauth2/token

I think that documentation was supposed to read :
https://[your developer salesforce domain]/services/oauth2/token