ADmad/cakephp-social-auth

[Facebook] Undefined property: stdClass::$picture

Closed this issue · 6 comments

Hello.
I'm getting the following error, just installed this plugin:

Undefined property: stdClass::$picture [ROOT/vendor/socialconnect/auth/src/OAuth2/Provider/Facebook.php, line 111]
I'm using this version:
"admad/cakephp-social-auth": "^0.5.1"

My cakephp3 is 3.5.*

ADmad commented

Make sure you have set proper values for scope and fields for facbook provider config so that picture is fetched.

Right, but i'm still having problems...
I've visited this doc: https://developers.facebook.com/docs/graph-api/reference/user, and tried to retrieve, for example... first name and last name:
'scope' => [ 'email', "first_name", "last_name", ], 'fields' => [ 'email', "first_name", "last_name", ]

This is what i got:
Invalid Scope: first_name.
Edit:
Sorry, i have duplicated some info on the config. Now it's almost working :
'scope' => [ 'email' ], 'fields' => [ // "id", 'email', "first_name", "last_name", "profile_pic", "birthday", "username", "gender"

ADmad commented

Scope and fields are different.

Ok. last question... i'm trying to get profile_pic but it's returning this on log:

This call requires a Page access token.

I do have a token, but i can't find where to set it to send to facebook.

ADmad commented

The application id and application secret is not enough? If an additional token is required please open and issue on SocialConnect/auth for how to pass the additional token in provider config.

I see.
Well, it seems that using this url i can get the profile picture of the user:
http://graph.facebook.com/" + id + "/picture?type=large
I'll check if something more is needed and if it is the case, i'll open an issue.

Thanks ADmad for your help \o