Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy over the profile picture from Facebook? #297

Closed
grenager opened this issue Feb 18, 2017 · 8 comments · Fixed by #315
Closed

Copy over the profile picture from Facebook? #297

grenager opened this issue Feb 18, 2017 · 8 comments · Fixed by #315

Comments

@grenager
Copy link

grenager commented Feb 18, 2017

Hi, it would be really helpful for me to get the profile picture from Facebook. Here's the required code change (I think):

const query = {
                appsecret_proof: Crypto.createHmac('sha256', this.clientSecret).update(credentials.token).digest('hex'),
                fields: 'id,name,email,first_name,last_name,middle_name,gender,link,locale,timezone,updated_time,verified,picture'
            };

            get('https://graph.facebook.com/v2.3/me', query, (profile) => {

                credentials.profile = {
                    id: profile.id,
                    username: profile.username,
                    displayName: profile.name,
                    name: {
                        first: profile.first_name,
                        last: profile.last_name,
                        middle: profile.middle_name
                    },
                    email: profile.email,
                    picture: profile.picture,
                    raw: profile
                };

                return callback();
            });

Better yet, it would be cool to allow users to specify the paths of the fields they want to copy out of the profiles into the session objects.

@pankajpatel
Copy link
Contributor

pankajpatel commented Feb 21, 2017

you can access the picture by the raw as raw.picture.

raw contains the JSON profile response received.

@grenager
Copy link
Author

grenager commented Feb 27, 2017 via email

@pankajpatel
Copy link
Contributor

@grenager You are right; though there would be many fields which facebook provides which can be included in the query.

I think it will be good to have an option for the provider to accept query param for the default request.

@grenager
Copy link
Author

grenager commented Feb 27, 2017 via email

@ricktbaker
Copy link

ricktbaker commented Jun 8, 2017

Any update on this? Is there any way to make it so it requests the profile image as well? I see we can directly modify the core provider code to add this, but that isn't a particularly great solution.

@pankajpatel
Copy link
Contributor

@ricktbaker PR needs to be submitted for this to make profile picture available as well.

PaulMougel added a commit to PaulMougel/bell that referenced this issue Jun 10, 2017
This commit adds a new option (and the first) configuration option
to the Facebook provider: `fields`, which allows to request
additional profile fields if needed.

This should be a non-breaking change, as the `fields` option has a
default value.

Fix hapijs#297
PaulMougel added a commit to PaulMougel/bell that referenced this issue Jun 10, 2017
This commit adds a new option (and the first) configuration option
to the Facebook provider: `fields`, which allows to request
additional profile fields if needed.

This should be a non-breaking change, as the `fields` option has a
default value.

Fix hapijs#297
@PaulMougel
Copy link
Contributor

I just submitted a PR to fix this issue, feedback and comments are welcome 👍

You will be able to specify the fields you want to retrieve from the user's profile, which will be available in credentials.profile.raw.

PaulMougel added a commit to PaulMougel/bell that referenced this issue Jun 13, 2017
This commit adds a new option (and the first) configuration option
to the Facebook provider: `fields`, which allows to request
additional profile fields if needed.

This should be a non-breaking change, as the `fields` option has a
default value.

Fix hapijs#297
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants