I'm working with this SSO plugin skeleton: https://github.com/julianlam/nodebb-plugin-sso-oauth to create my own.
I want to add a check to see if the user who is trying to connect to this 3rd party is already logged in to NodeBB, if so I would like to disregard the email address provided by the 3rd party sso and just add the other fields from the sso provider to his profile.
The reason for this is becuase whenever a user is already logged in and tries to connect via SSO and that he is registered in that 3rd party with a different email address, NodeBB will create a new user.
I can see that I need to add a check under the OAuth.login
function but not sure how to check if there's currently a logged in session for this user.