I have created a connected app in sandbox. I Have set Selected OAuth Scope = Full
I Have relaxed IP restrictions in connected app policies. When i make HTTP POST to get access token, error is returned with Status code 400. We dont have any security tokens in our sandbox org. hence password is not appended with securtiy token. when i make same HTTP POST for production URL with details of a connected app from PROD it returns access token successfully
endpoint : https://test.salesforce.com/services/oauth2/token
Header : Content-Type = application/x-www-form-urlencoded
Body: grant_type = password
client_id = xxxxxxx
client_secret = xxxxxxx
username =
password =
Status code:400 Bad request is returned
Error:
{
"error": "invalid_grant",
"error_description": "authentication failure"
}
Best Answer
Changing from test.salesforce.com to my sandbox domain worked