-
Notifications
You must be signed in to change notification settings - Fork 56
Description
In response to comments on this page: https://knpuniversity.com/screencast/oauth/facebook2
This caught me up as well. The call to $facebook->api('/me')
only returns 2 fields, 'id'
and 'name'
even with 'publish_actions'
and 'email'
permissions on the app. What the cluck?!
According to this post http://stackoverflow.com/questions/32584850/facebook-js-sdks-fb-api-me-method-doesnt-return-the-fields-i-expect-in-gra as of v2.4, there has been a change in the api and it no longer returns all of the fields that it used to by default, you must explicitly request the fields you want.
FCL login with Facebook would not work for me until I changed the api call to $facebook->api('/me?fields=email,first_name,last_name')
This returns an array with 4 fields, ['email','first_name','last_name','id']
Eggs-cellent course Ryan & Leanna, thanks a bunch!
Tom
Activity
weaverryan commentedon Apr 22, 2016
@codesman - ah, thank you! This one had puzzled me, so I hope this is the solution. The app I created for the screencast is still set to the v2.0 API version, which allows the API calls to be made to this version. If you create a new app, it likely sets the minimum version to the latest version of the API.
@bocharsky-bw Could you update the code (I think it's the step
Facebook: Request to /me
) to make the following change in FacebookController:I just confirmed that this works. We should also probably add a note.
Thanks!
Request required fields explicitly from Facebook and add a note
bocharsky-bw commentedon Apr 22, 2016
Easy win for me! We haven't smart code blocks for this tutorial.
I haven't write permissions to this repo so I open one more PR :)
@weaverryan Could you merge it if looks good?
bocharsky-bw commentedon Apr 25, 2016
Fixed in #58.
@codesman Thank you for this report!