Skip to content

FCL login with Facebook fails #57

@codesman

Description

@codesman

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

weaverryan commented on Apr 22, 2016

@weaverryan
Member

@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:

// before
$json = $facebook->api('/me');
// after
$json = $facebook->api('/me?fields=email,first_name,last_name');

I just confirmed that this works. We should also probably add a note.

Thanks!

bocharsky-bw

bocharsky-bw commented on Apr 22, 2016

@bocharsky-bw
Member

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

bocharsky-bw commented on Apr 25, 2016

@bocharsky-bw
Member

Fixed in #58.

@codesman Thank you for this report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @weaverryan@codesman@bocharsky-bw

        Issue actions

          FCL login with Facebook fails · Issue #57 · knpuniversity/oauth