Reputation: 811
Currently I have list of gmail accounts, and I need to associate them with their ID's. For example the gmail I have as follows [email protected]
, and I need to have its ID. I am quite confused with online examples. Please give at least ideas of achieving the result. Thanks before hand.
Upvotes: 2
Views: 613
Reputation: 116968
You will need to have the user who owns [email protected] to authenticate your application using gmail api and Oauth2.
Once you have an access token for that user you can then make a call ot the user info endpoint
https://openidconnect.googleapis.com/v1/userinfo?access_token={token}
This will return the Google profile information for that user and it will give you their internal google user id.
There is no way to get a Google user id for a user who has not authenticated your application. You have to have someones permission for this kind of thing.
Upvotes: 3