The default implementation of OAuthAuthorizationServerHandler
only accepts form encoding (i.e. application/x-www-form-urlencoded
) and not JSON encoding (application/JSON
).
Your request’s ContentType
should be application/x-www-form-urlencoded
and pass the data in the body as:
grant_type=password&username=Alice&password=password123
i.e. not in JSON format.
The chrome example above works because it is not passing data as JSON. You only need this for getting a token; for other methods of your API you can use JSON.
This kind of problem is also discussed here.