Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not getting user picture with google login

Tags:

oauth-2.0

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

The scope which I have used is userinfo. I'm getting all the userinfo except the picture. I accessed both the V1 and V2 links with the access token which I received. The links, if I am not mistaken are, -

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 these, the picture info is missing. I receive the following responses-

{
 "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 some other way to get the picture? Is there a link to the user picture (like in facebook authentication).

like image 293
Siddharth Avatar asked Feb 17 '12 15:02

Siddharth


1 Answers

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

like image 118
Juan Mellado Avatar answered Oct 10 '22 03:10

Juan Mellado