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

Facebook allow Email scope not working, It's not return "email" ? #290

Open
bombkiml opened this issue Mar 30, 2023 · 4 comments
Open

Facebook allow Email scope not working, It's not return "email" ? #290

bombkiml opened this issue Mar 30, 2023 · 4 comments

Comments

@bombkiml
Copy link

Scope allow :

app.get('http://localhost/authentication/facebook', passport.authenticate('facebook', { 
    scope: ['email', 'public_profile'] 
}));

Result:

{
  id: '5900246411513451',
  username: undefined,
  displayName: 'John Wick',
  name: { familyName: 'Wick', givenName: 'John', middleName: undefined },
  gender: undefined,
  profileUrl: undefined,
}

Why without email return ????

@sgarner
Copy link

sgarner commented May 11, 2023

You have to tell the library which fields from the profile to fetch, using the profileFields option when you call the FacebookStrategy constructor:

new FacebookStrategy({
  clientID,
  clientSecret,
  callbackURL,
  profileFields: ['id', 'email', 'name'],
})

@0gebey
Copy link

0gebey commented Sep 12, 2023

I am also trying the same thing but it doesn't work even with the 'email' field inside the 'profileFields'

@dev-george-nikolaidis
Copy link

Hey, did someone come with solution?

@bombkiml
Copy link
Author

bombkiml commented Nov 9, 2023

Hey, did someone come with solution?

Hi bro, I can fix by add Permissions.
Must allow Permissions facebook profile fields : https://developers.facebook.com/docs/graph-api/reference/v13.0/user#readperms

new FacebookStrategy({
  clientID,
  clientSecret,
  callbackURL,
  profileFields: ['id', 'email', 'name'],
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants