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
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
Suraj Tripathi 47Suraj Tripathi 47
Hi Rajat Mahajan ,
One reason can be your security token. You have to use your salesforce password+ security token in the place of password.
You can recheck the all speps in the below link:-
link :- https://www.appseconnect.com/how-to-connect-salesforce-and-postman-using-rest-api/

In case you find any other issue please mention. 
If you find your Solution than mark as this as a best answer. 

Thanks and Regards
Suraj Tripathi.
Koodal Sailappan 1Koodal Sailappan 1
Thanks Suraj, it works with salesforce password followed by giving the security token although its weird salesforce interpreting them