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? Dec 23, 2021 at 9:38
  • yes user profile has access to connected app.
    – Ghanekar
    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 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
    Dec 24, 2021 at 3:45
  • You can maybe log a case with Salesforce and ask Dec 25, 2021 at 9:10

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.