0

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" }

5
  • Does the user profile have access to the connected app? Commented Dec 23, 2021 at 9:38
  • yes user profile has access to connected app.
    – Ghanekar
    Commented Dec 23, 2021 at 10:07
  • Maybe check the login history of the user to see if there's a more specific error. Also, replace test.salesforce.com with your sandbox domain Commented Dec 23, 2021 at 11:50
  • Changing from test.salesforce.com to my sandbox domain worked. But in PROD i am using login.salesforce.com and it still works for PROD. so dont know the reason why in sandbox behaviour is different. But it worked Thanks
    – Ghanekar
    Commented Dec 24, 2021 at 3:45
  • You can maybe log a case with Salesforce and ask Commented Dec 25, 2021 at 9:10

1 Answer 1

1

Changing from test.salesforce.com to my sandbox domain worked

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .