0
votes

I guess this is a 2-part question.

I am using Postman to test the connected app I set up in a Salesforce sandbox environment. Should I be sending the request to https://login.salesforce.com/services/oauth2/token or https://xxx--partial.lightning.force.com/services/oauth2/token", which is our sandbox?

When I send the request to https://login.salesforce.com/services/oauth2/token I receive an "Invalid_grant" error with a description of "authentication failure". If I change the url to "https://xxx--partial.lightning.force.com/services/oauth2/token", which is our sandbox, I get an "invalid_request" error with a description of "must use HTTP POST". Here is the url with parameters: https://xxx--partial.lightning.force.com/services/oauth2/token?grant_type=password&client_id=clientIdHere &client_secret=clientSecretHere&username=myEmailAddress&password=myPassword&Content-Type=application/x-www-form-urlencoded

Any help is greatly appreciated.

Also posted here : https://salesforce.stackexchange.com/questions/307644/what-is-the-authorization-url-if-authorizing-against-a-sandbox-environment

1

1 Answers

0
votes

If you’re verifying authentication on a sandbox organization, use “test.salesforce.com” instead of “login.salesforce.com” in all the OAuth endpoints listed above.

https://test.salesforce.com/services/oauth2/token