简体   繁体   中英

Google API - How do I get alias emails for a user?

Question

Using Google Apps OAuth for authentication, how can I retrieve a user's email aliases?

I can't seem to find any API docs on how to do this. What are the necessary scopes and what is the correct call to get that info?

Why

Let's say I have a user Alice that invites bob@company.com to use the app. Unfortunately, bob@company.com is actually an alias for bob.jones@company.com . When Bob logs into the service with Google OAuth, Google tells me his email address is bob.jones@company.com . Now I have accidentally created two accounts for Bob when I want to recognize them as the same account.

You can use the Google People API for this. Here's the documentation . The scope you need to use is: https://www.googleapis.com/auth/user.addresses.read

This will return all the email addresses for the user and also tell you which is the primary one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM