'invalid client when POSTing JSON to get OAuth token
I am using perl to POST a JSON object to fetch an Oauth token but am getting an "invalid_client" response. (I checked, and it doesn't look like I have a Client Secret set up.) I'm following the sandbox tutorial/walkthrough but am stuck at this point. Here are the relevant details (redacted):
url: 'https://sandboxapi.ordercloud.io/oauth/token'
JSON data
{
client_id: "XXXX",
grant_type: "password",
username: "admin01",
password: "XXXX",
scope: "CatalogAdmin BuyerReader MeAdmin InventoryAdmin PasswordReset OrderAdmin PriceScheduleAdmin ProductAdmin ProductAssignmentAdmin ShipmentAdmin"
}
Headers: Content-Type => 'application/json', Content => [JSON above]
I'm not sure if I have the url correct or if I have all necessary headers. I'm guessing the SDK abstracts a lot of that stuff but I'm not using it.
Solution 1:[1]
The accepted Content-Type is application/x-www-form-urlencoded for authentication calls to OrderCloud. You can read more about authentication here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | M. Posthumus |
