Spring Security Oauth2 Plugin with Json Tokens

Asked

Viewed 129 times

0

Can anyone tell me if the Spring Security Oauth2 plugin supports access tokens in JSON format instead of XML format? And if yes what needs to be done to make that change?

1 answer

1

Yes, it does. By default it already returns a JSON. In some newer versions of Spring Oauth2 it requires you to set a return pattern in Spring. Much depends on the Spring Framework and Spring Security Oauth2 version.

The default configuration I have now, using java, config is:

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.ignoreAcceptHeader(true)
                    .defaultContentType(MediaType.APPLICATION_JSON);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.