[SalesForce] Rest UserName/Password authentication not working!

I am trying to get aouth token from using the username and password authentication for Salesforce rest api.

I am using this url: https://login.salesforce.com/services/oauth2/token

I am using this Header:

grant_type: password
content-type: application/x-www-form-urlencoded
client_id: 3MVG9Y6d_Btp4xp7vvFtoM5KvlxGGeHkTNHMBRocXHDKgrY.**********************
client_secret: 77228**********
username: ******@****.com
password: ********ESbfkvMHuULtcEROf6CNiMRZ

I am also giving the accesstoken in the password.
but I am always getting this:

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

enter image description here

Best Answer

instead of using this Endpoint https://login.salesforce.com/services/oauth2/token

Change your Endpoint to https://[Your salesforce instance].salesforce.com/services/oauth2/token

Example :https://ap1.salesforce.com/services/oauth2/token

Related Topic