Search code examples
javagoogle-oauth

How to get user's email after google oauthed


I'm using google oauth 2 to handle the login function. But I don't want anyone to login, so how can I get user's email after he/she oauthes successfully, then i can do the second round authentication, thanks.


Solution

  • You can't that is the entire point of OAuth, you can't get any specific information about the user other than the other system says they are who they say there are.

    You will have to access one of Google's other services to get information like you want, OAuth specifically is designed not to share this type of information.