4

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 Answers 3

12

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.

1
  • In my case, it was definitely the domain. I sent everything in the URL including the password WITHOUT the token. It works! Thank you @Sriram
    – Hoodlum
    May 29, 2020 at 11:31
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.

3

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
1
  • Security Token did not help :( Any other check ?
    – Sriram
    Jun 20, 2019 at 22:26

You must log in to answer this question.

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