I have an application where the user can login via a single OAuth2 provider using spring-boot-starter-oauth2-client. This works well. What I now want to do is add the ability for a logged in user to “login” with a different provider just for us to retrieve their username on that service. What would be the correct way to go about implementing this?
I’ve created a custom OAuth2UserService that checks if the user is already authenticated. How would I then make sure that the resulting login with the other provider is only used to extract a value and nothing else related to login/sessions?