Do not get user image using google login

I made a Google login with OAuth2 and the PHP library, which can be found on the documentation site.

The volume I used is userinfo. I get all userinfo except the picture. I got access to links V1 and V2 with the access token that I got. Links, if I'm not mistaken, -

https://www.googleapis.com/oauth2/v1/userinfo?access_token=<access-token> https://www.googleapis.com/oauth2/v2/userinfo?access_token=<access-token> 

For both of them, image information is not available. I get the following answers -

 { "id": "<some-id>, "email": "<correct-email-id>", "verified_email": true, "name": "Siddharth Saha", "given_name": "Siddharth", "family_name": "Saha", "link": "<google-plus-link>", "gender": "male", "locale": "en" } 

Is there any other way to get the picture? Is there a link to the user's image (e.g. in facebook authentication).

+6
source share
1 answer

From a comment: But do you really have a picture on your profile? I think the "picture" attribute is only included if you have a photo. I follow your "link", not photos.

+3
source

Source: https://habr.com/ru/post/908722/


All Articles