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
Akash MangroliyaAkash Mangroliya 

Not able to get access token

I want to get access token using java rest but getting error like
{
"error": "unsupported_grant_type"
"error_description": "grant type not supported"
}
This is the request,
POST https://login.salesforce.com/services/oauth2/token
Content-Type: application/x-www-form-urlencoded
client_id:3MVG9ZL0ppGP5UrB5oz4M4HieQ2*******************KNvxN60DVCptuS5c
client_secret:493********************774
redirect_uri:https://localhost/myapp
code:aPrxqJ8A8kLOza8S3awq7IR9_.EZGOpsrHjfBAZTZOWKk0c5YpaLvJLsz_EVQfHLL5taX4hnVA%3D%3D
grant_type:authorization_code

I am passing all the parameter currectly but still getting error.
Somebody help me please :)
Amit VaidyaAmit Vaidya
Hi Akash,

The request is looking fine. It might be looking space issue. Please check there is no any space before grant_type=authorization_code in HTTP POST.

Thanks,
Amit
Akash MangroliyaAkash Mangroliya
Hi Amit,
there is no space in grant_type please look at my request still getting same error...

POST https://login.salesforce.com/services/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
[Code=aPrxqJ8A8kLOza8S3awq7IR9_3mXIM7HeoTvTZgv2fYfEekrYYhuvRks9aPjDkeebCAvstcLiQ%3D%3D, grant_type=authorization_code, client_id=3MVG9ZL0ppGP5UrB5****************************nx1EtdjnRnHi_j8DdKNvxN60DVCptuS5c, client_secret=4937********55774, redirect_uri=https://localhost/myapp]