oauth-2.0openid-connectgoogle-oauthgoogle-openidconnect

Google Oauth2 Prevent duplicate email address?


I created a website for an organization where users can log in with there gsuite accounts from google, let say, user john logged in using john@doe.com, and do his todos.now imagine user john left an organization and another new user called john, get the new google account called john@doe.com, when new john gets logged in using google how to check weather its a new gmail or old?


Solution

  • If you are using OpenID Connect, which you should if you need the Authentication of the user and this type of detail, then the combination of the "iss" and the "sub" claim within the access_token are guaranteed to be unique.