I am using Postman to test the connected app I set up in a Salesforce sandbox environment. When I send the request to https://xxx--partial.lightning.force.com/services/oauth2/token, 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

How can I obtain the access token with username/password in a sandbox?

  • test.salesforce.com or the xxx--partial.lightning.force.com domains should work. The error indicates that you need to use POST (as opposed to GET) to make the request. Do you have Postman set to make that request as a POST? Also, the username-password flow should generally be avoided.
    – Derek F
    May 28, 2020 at 21:51
  • I am using Post. I've read all the stuff about not using password, but JWT was failing completely. I was hoping to get password working then at least I would know I was hitting the correct endpoint. It is odd that changing the URL causes the post error even though I am posting.
    – Hoodlum
    May 28, 2020 at 22:03


Browse other questions tagged .