How to get custom user info from OAuth2 authorization server /user endpoint

The solution is the implementation of a custom UserInfoTokenServices https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServices.java Just Provide your custom implementation as a Bean and it will be used instead of the default one. Inside this UserInfoTokenServices you can build the principal like you want to. This UserInfoTokenServices is used to extract the UserDetails out of the response of the /usersendpoint … Read more