Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get email address with google access token?

I'm not able to get the email id from the Response Here the Response:

{
  "id": "00000000000000",
  "name": "Fred Example",
  "given_name": "Fred",
  "family_name": "Example",
  "picture": "https://lh5.googleusercontent.com/-2Sv-4bBMLLA/AAAAAAAAAAI/AAAAAAAAABo/bEG4kI2mG0I/photo.jpg",
  "locale": "en"
}

and this is what I'm using:

https://www.googleapis.com/oauth2/v1/userinfo?access_token=' + token

like image 412
Mahendra Avatar asked Nov 23 '25 18:11

Mahendra


1 Answers

You may need a different scope. According to documentation, the scope https://www.googleapis.com/auth/userinfo.profile allows you to see basic profile info. In order to see the e-mail, you need this scope: https://www.googleapis.com/auth/userinfo.email.

like image 89
Iván Nokonoko Avatar answered Nov 26 '25 09:11

Iván Nokonoko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!