1. When you face {“error”:”unsupported_grant_type”,”error_description”:”grant type not supported”} error, put all the information in the body instead of header. Check the following image for reference.
2. If you are using POST, check whether the Content-Type is set as application/x-www-form-urlencoded
3. Check whether setBody() has correct body data.
4. Do not use Salesforce Instance URL. For Example, please don’t use https://na102.salesforce.com/services/oauth2/token. Instead use, login.salesforce.com for Production and test.salesforce.com for Sandbox.
5. Make sure the correct OAuth Scopes are selected in the Connected App.
6Lightning URL “https://{Your Domain}.lightning.force.com” shouldn’t be used. Instead, My Domain URL “https://{Your Domain}.my.salesforce.com” should be used.