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
email is not returned #189
Comments
+1 here. Same issue. |
You need to do the following when authenticating: |
Hi, I am having the same issue. Please see my code below. Not being able to request additional permissions... router.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email']})); passport.use(new FacebookStrategy({ |
+1, requesting both in scope
and profileFields:
|
After checking the official facebook APIs, it seems that passport is broken.. or there's something I don't get. Here's a working url created by hand using the facebook docs (paste it in the browser adding your app id and you'll see the popup):
And here's the url that passportjs generates (passing
Clearly the scope doesn't get appended to the url, now we should investigate why and what's the right way to add scope to the request. .. maybe looking at the passport.authenticate() function in the source code could help? @rsnider19 do you know something more? |
I used the following and it worked: passport.use(new FacebookStrategy({
clientId: ...,
clientSecret: ...,
callbackURL: ....,
profileFields: ['id', 'displayName', 'email', 'first_name', 'middle_name', 'last_name']
})) |
I tried the following, and it is still not working.
When I tried the Graph API V 2.7 with |
Try it
|
For me this happens when users have restricted the visibility of their email address to only themselves. |
@rsnider19 , Thanks man your solution worked. |
@rsnider19 Thanks man... Your solution works..... Guys go for it..... |
The provided solutions (email in bot scope and in profileFields) work, and produce an object that looks just like the GoogleStrategy's. Any problems with the scope term missing from the URL (vyzen's post) appear resolved; it looked normal to me even when I was using the wrong scope strings. Recommend close. |
You can use specified strings in this URL https://developers.facebook.com/docs/facebook-login/permissions#reference-default Below is a snippet for strategy configuration
|
I'm facing the same and I guess when it happens is something related to the following documentation and not passport it self:
I've just implemented this as an alternative: const { email, first_name, last_name, id} = profile._json;
const userData = {
email: email || id, // If there's no e-mail, uses user's Facebook id
nome: `${first_name} ${last_name}`,
}; I don't like it. But I hope it works. |
Works for me |
Hi,
I'm using nodejs and expressjs with passport-facebook for user to signup account with fb account. I found a facebook user account is not returning the email. The user don't signed up with the Phone number instead. Only email is saved in the account contact. In addition, the email has been verified. I don't know what is problem. Anyone has an idea?
My strategy
The text was updated successfully, but these errors were encountered: