I have setup my 'Salesfore' connected App for 'OAuth' using which I am able to authenticate user. For subsequent request I am trying to get access token hence posting values to Salesforce as below.
$.post("https://login.salesforce.com/services/oauth2/token",
{
"grant_type": "authorization_code",
"code": "00DXXXX5",
"client_id": "3MVXXXXK",
"client_secret": "15XXXX4",
"redirect_uri": "https://mysit11e.com/SalesforceCallback.aspx"
});
but unfortunately I am having an error
"error":"invalid_grant","error_description":"invalid authorization code"
I have made sure there is not % symbol is not present in code hence replaced %21 with !.
What else shall I try to get this working.
you appear to be posting it as json try posting it as a request string
grant_type=authorization_code&code=00DXXXX5&client_id=3MVXXXXK&client_secret=15XXXX4&redirect_uri=https://mysit11e.com/SalesforceCallback.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With