+ Start a Discussion
Rajat Mahajan 33Rajat Mahajan 33 

Access Token Not Retrieved - Getting unsupported_grant_type error on POSTMAN and Advanced REST Client of Chrome - Please

I am trying to perform a basic step (this works when i write an apex class and then try to get the access token, but does not when i do the same from google chrome extensions)

Please see the details:
I am hitting the URL :


And i am giving these as headers:
grant_type: password
client_id: 3MVG9Y6d_Btp4xp6.aP2dpK_QvKPMy.wCLzvqeElabZryrMYgZfEyCCMVUg5fm.6SqUW5525mr3xgXNStu2IM
client_secret: 7269476387055204688
username: --------@gmail.com
password: --------
Accept: application/json

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

I tried adding the Content-Type parameter as well, but does not work.
Kindly help!

Regards
Rajat
Rajat Mahajan 33Rajat Mahajan 33
The URL i am hitting is : 
https://ap1.salesforce.com/services/oauth2/token
Vinoth Vijaya BaskerVinoth Vijaya Basker
Please try with the below Content Type in Header, 

application/x-www-form-urlencoded

Thanks,
Vinoth
Rajat Mahajan 33Rajat Mahajan 33
Hi Vinoth

As already indicated, i tried to put the Content-Type

but this does not work in POSTman or Adv REST Client.

All this works if i go throug apex code

:(

Please help

 
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi, 

I could see that in the header you provided , 

Accept: application/json

Please change it from application/json into application/x-www-form-urlencoded to get the token. 

Thanks,
Vinoth
 
Rajat Mahajan 33Rajat Mahajan 33
Hi Vinoth, even that does not work.

This is strange as i provide the same from apex class and it works.
One additional parameter that i provide in apex class is Authorization : 'Basic Blob value of username and password'

But its nowhere written to provide that in POSTMAN so never used.
Please help

Regards
Rajat Mahajan
Balwinder KumarBalwinder Kumar
Hi Rajat,

You need to ensure that the user you are trying to connect with have an access to this connected app. Please check the profile of a user and see if this connected app is checked there.

Hope this solves your issue.

Regards,
Balwinder