How to force Spring Security OAuth 2 to use JSON instead of XML?
brubraz opened this issue · comments
Bruno Braz commented
I've created Spring MVC application and set up Spring Security OAuth 2. While calling methods from my brower I get XML:
<oauth>
<error_description>
Full authentication is required to access this resource
</error_description>
<error>unauthorized</error>
</oauth>
Instead of JSON:
{
"error": "unauthorized",
"error_description": "An Authentication object was not found in the SecurityContext"
}
Browser sends following header:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
When I set json accept header I get JSON. I need to force my authorization server always send JSON. Haven't found any solution. Thanks.