Get all email addresses of user using Google API

前端 未结 4 1851
醉酒成梦
醉酒成梦 2021-02-15 12:13

For my own gmail account, I have multiple email addresses associated with it. For example, I have an email address from my university that is associated with my gmail, and I ca

4条回答
  •  孤城傲影
    2021-02-15 12:35

    If you use OAuth to have your users sign-in with their Google accounts (with or without G+) the user will be prompted (by Google) to select which of their accounts they wish to authorize your application to use: https://developers.google.com/accounts/docs/OAuth2Login

    So to directly answer your question, I'm not aware of an API to return that list of users - however you shouldn't need to, Google will take care of this before returning to your application.

    If your user is already logged in, and you wish to give them the ability to change the Google account they are using, I believe it is possible to prompt them again to select the account they are interested in (search for select_account on the link above).

提交回复
热议问题