3

grant_type—Value must be password for this flow.
client_id—Consumer key from the connected app definition.
client_secret—Consumer secret from the connected app definition.
username—End-user username.
password—End-user password

I am sending the above details to the https://mydomain/services/oauth2/token with headers content-type as application/x-www-form-urlencoded but still i get the below response

{
    "error_description": "grant type not supported",
    "error": "unsupported_grant_type"
}

What am I doing wrong?

3

Double check against that you are sending the Content-Type header as application/x-www-form-urlencoded and that you are encoding the parameters correctly. I.e. Note that the @ in the email becomes %40.

Here is a working example I did using Postman in Chrome.

Raw POST body:

grant_type=password&client_id=3MVG9iTxZANh12345678901234567890X9eYLSx.q6x8yD3Q.IT3nRSYXxzGpQqhw5m7nxK6aBxXH70ZH84cV&client_secret= 5912345678901234567&username=daniel.ballinger%40mycompany.com&password=somePasswordWithSecurityToken

enter image description here

  • i am doing the same but still it gives me the error ,do i have to set anything on salesforce,infact i treid exactly on postman. – Kartik Marujolla Apr 15 '15 at 14:31
  • I assume you used your App "Consumer Key" as the client_id and "Consumer Secret" as the client_secret? Are you working against a Sandbox or Production/Dev org? – Daniel Ballinger Apr 15 '15 at 23:46
  • What OAuth Scopes have you selected? I have: "Access and managed your data (api)", "Provide access to your data via the Web (web)", and "Perform requests on your behalf at any time (refresh_token, offline_access)" on my Connected App. – Daniel Ballinger Apr 15 '15 at 23:47
  • Access your basic information (id, profile, email, address, phone) Access and manage your data (api) Provide access to your data via the Web (web) Full access (full) Access and manage your Chatter data (chatter_api) Provide access to custom applications (visualforce) Perform requests on your behalf at any time (refresh_token, offline_access) Allow access to your unique identifier (openid) Access custom permissions (custom_permissions) these are the scopes m using – Kartik Marujolla Apr 29 '15 at 21:26
  • 1
    @DanielBallinger I've opened this issue as a separate question: salesforce.stackexchange.com/questions/85349/… – JLewkovich Jul 29 '15 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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