Org: Developer org. I faced a strange issue. I was generating the access token by providing client id, client secret, username and password. I used 2 following cURL commands :
curl https://login.salesforce.com/services/oauth2/token -d “grant_type=password” -d "client_id=--client_id--" -d "client_secret=--client_secret--" -d "[email protected]" -d "password=pwd" .
Result : {"error":"unsupported_grant_type","error_description":"grant type not supported"}
curl -d "[email protected]" -d "password=pwd" -d "client_id=--client_id--" -d "client_secret=--client_secret--" -d "grant_type=password" https://login.salesforce.com/services/oauth2/token
Result (success) :
{"access_token":"token","instance_url":"https://ap1.s
alesforce.com","id":"https://login.salesforce.com/id/...","token_type":"Bearer","issued_at":"1441611103702","signature":"..signature.."}
Could anyone please explain why placing the SFDC url (https://login.salesforce.com/services/oauth2/token) at the end result in generation access token.
Kindly note: security token is not appended with password while generating access token as Developer org does not have this option (another strange thing)
curl https://login.salesforce.com/services/oauth2/token
gives me same result{"error":"unsupported_grant_type","error_description":"grant type not supported"}
. So definitely some sloppiness on Salesforce side generating wrong error messages AND on curl side skipping your parameters.