Getting "error": "unsupported_grant_type" when trying to get a JWT by calling an OWIN OAuth secured Web Api via Postman
The response is a bit late - but in case anyone has the issue in the future...
From the screenshot above - it seems that you are adding the url data (username, password, grant_type) to the header and not to the body element.
Clicking on the body tab, and then select "x-www-form-urlencoded" radio button, there should be a key-value list below that where you can enter the request data
With Postman, select Body tab and choose the raw option and type the following:
grant_type=password&username=yourusername&password=yourpassword
- Note the URL:
localhost:55828/token
(notlocalhost:55828/API/token
) - Note the request data. Its not in json format, its just plain data without double quotes.
[email protected]&password=Test123$&grant_type=password
- Note the content type. Content-Type: 'application/x-www-form-urlencoded' (not Content-Type: 'application/json')
When you use JavaScript to make post request, you may use following:
$http.post("localhost:55828/token", "userName=" + encodeURIComponent(email) + "&password=" + encodeURIComponent(password) + "&grant_type=password", {headers: { 'Content-Type': 'application/x-www-form-urlencoded' }} ).success(function (data) {//...
See screenshots below from Postman: