Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to force Spring Security OAuth 2 to use JSON instead of XML? #47

Open
brubraz opened this issue Mar 24, 2016 · 1 comment
Open

How to force Spring Security OAuth 2 to use JSON instead of XML? #47

brubraz opened this issue Mar 24, 2016 · 1 comment

Comments

@brubraz
Copy link

brubraz commented Mar 24, 2016

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.

@aksappy
Copy link

aksappy commented Apr 6, 2016

@burnaz I kind of get JSON always in my current Spring Security configuration. Can you post the dependencies version please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants