0

OAuth 2.0 Auth token request failed with below error

{
"error": "invalid_request",
"error_description": "must use HTTP POST"
}

What does this error mean?

I am using Postman. Have a connected app. I have used Post method, Url has https. Same request works for other Orgs. Did I missed any configuration/Permission check?

https://testOrg.lightning.force.com/services/oauth2/token?grant_type=password&client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}&username={{USER_ID}}&password={{PASSWORD}}
3

The request parameters (grant_type, client_id and so on) must be sent in the request body . The docs mention this (note the phrase example request body) but they aren't very explicit about this requirement.

2

Below s what your POST request should look like.Please note the password might need the password+token concatenated:

Endpoint: https://XXXXX.my.salesforce.com/services/oauth2/token

Request Body:

client_id: lorem-ipsum-a
client_secret: lorem-ipsum-b
username: lorem-ipsum-c
password: lorem-ipsum-d //**NOTE YOU MIGHT NEED TO DO PASSWORD+TOKEN**
grant_type:password
  • Security Token did not help :( Any other check ? – Sriram Jun 20 at 22:26
2

Problem is with domain name used in url. :|

Using the domain as in "Setup > My Domain" fixed the issue.

I have used : https://testOrg.lightning.force.com/ (Did not work)

Supposed to be: https://testOrg.my.salesforce.com/ (Worked)

Thanks.

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.