I am getting authorization code and when i am trying to get the access token than it give error like

"error": "unsupported_grant_type"
"error_description": "grant type not supported"

This is my POST request,

POST https://login.salesforce.com/services/oauth2/token

Content-Type: application/x-www-form-urlencoded
grant_type: authorization_code

But I am not able to get the access token.Can anyone help me please :)

  • Are you setting the grant_type, client_id, client_secret,redirect_uri and code inside the body or in headers? These need to be in the body of the request. – prashanthkr Jun 6 '16 at 16:01
  • Yes, i m passing all the parameter in request body but then also it's not work.Help me please :) – Akash Manngroliya Jun 7 '16 at 5:27
  • I don't know which language you are using to make this post request, but if you are constructing the body, it should be something like code=aPrx....&client_id=xxxx&client_secret=XXXX etc. – prashanthkr Jun 7 '16 at 17:01
  • i use java and i have all the required parameter to get the access token but still i m not able to get :( – Akash Manngroliya Jun 21 '16 at 6:24
  • Are you setting the required params in the format I mentioned above? – prashanthkr Jun 21 '16 at 17:08

in the access token request you are adding grant_type. that is not required so remove that parameter and your problem will be solved.

| improve this answer | |
  • Tushar, after removing grant_type i m getting same error and in sales force doc clearly said that this field is required... – Akash Manngroliya Jun 6 '16 at 13:38

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.