Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Facebook Login is not Working #697

Closed
benmarten opened this issue Jul 24, 2015 · 20 comments · Fixed by #842
Closed

Facebook Login is not Working #697

benmarten opened this issue Jul 24, 2015 · 20 comments · Fixed by #842
Assignees
Milestone

Comments

@benmarten
Copy link

The Facebook Login is not working and it does not throw any error in the console or web console.
The Facebook redirect works, but then in the application nothing is happening.
I have configured the App_id and secret. What's missing?

@benmarten
Copy link
Author

Ok, hunted it down to a missing e-mail: jaredhanson/passport-facebook#129
And also this solution: #202

@lirantal
Copy link
Member

@benmarten on which branch is this? master or 0.4.0, and are you updated to the latest version there?
@ilanbiala since you were involved in #202 can you look into this with Ben?

@benmarten
Copy link
Author

Ok, tested this real quick by cloning 0.4.0 branch and just configuring my fb app id.
It does not work. Only works when adding this line to passport.use(...):
profileFields: ['email']
to config/strategies/facebook.js:18
as described: jaredhanson/passport-facebook#129

@ilanbiala
Copy link
Member

@benmarten is that found in the FB docs too?

@codydaig
Copy link
Member

@benmarten Looking at the 0.4.0 code and the facebook strategy:
https://github.com/meanjs/mean/blob/0.4.0/modules/users/server/config/strategies/facebook.js#L16
it seems that the profileFields already includes 'email' in the array. What specifically needs to be changed?

@lirantal
Copy link
Member

@codydaig @benmarten it seems like your find matches the 'emails' profileField while @benmarten was showing success cases referrencing 'email' profileField (notice the plural vs singular use).

I'm unable to test as I don't have a FB account but we should fix this if it's an actual problem on 0.4.0
@benmarten can you look into making this change to 0.4.0 and submit a PR that fixes it? I would just add the 'email' element to that array in https://github.com/meanjs/mean/blob/0.4.0/modules/users/server/config/strategies/facebook.js#L16 and test it out.

@codydaig
Copy link
Member

@ilanbiala https://developers.facebook.com/docs/graph-api/reference/v2.3/user
There is no 'emails' field, it's only 'email'.

@benmarten Do you want to create the PR against the master branch?

@codydaig
Copy link
Member

#839

@codydaig
Copy link
Member

@benmarten @lirantal I have tested this on the latest branch, and it works with 'emails' so I am unable to reproduce this issue.

@benmarten
Copy link
Author

Hey, so it seems that in latest master branch strategies/facebook.js is gone... I tested it again, and now i see the following error message:
screen shot 2015-08-23 at 21 58 38

@rhutchison
Copy link
Contributor

@lirantal lirantal added this to the 0.4.x milestone Aug 23, 2015
@lirantal lirantal self-assigned this Aug 23, 2015
@benmarten
Copy link
Author

Ah ok found it ;)

So first I see this issue:

GET /api/auth/facebook?redirect_to=%2F 302 2.370 ms - 0

which seems to lead to the error in the screenshot from above.

Second, the fb login is not working for me now either...
I tested it by putting some console.log() in the code and it seems that config/strategies/facebook.js isn't called anymore at all! Now only user.oauthCall() function is called...

@lirantal
Copy link
Member

@rhutchison seems related to the issue I recently merged about the previous page in history bug (cfe71bb)

@benmarten
Copy link
Author

Just a wild guess, but i think that passport seems to be called directly now from here:
https://github.com/meanjs/mean/blob/master/modules/users/server/controllers/users/users.authentication.server.controller.js#L97

instead the code which resideds in facebook.js, should be called from that line, shouldn't it?

@rhutchison
Copy link
Contributor

@benmarten @lirantal what are the steps to reproduce?

I am unable to reproduce in my environment, but I might be missing something.

@benmarten are you sure your facebook config/callback url are setup correctly in the configuration? When you see the page not found, what is the URL in the address bar?

@rhutchison
Copy link
Contributor

@benmarten please make sure your environment config is updated to reflect this change

@mleanos
Copy link
Member

mleanos commented Aug 25, 2015

@rhutchison I've tested these changes from #842 , and everything seems to be working fine for me. Although, I experienced the Page Not Found issue before I had updated my local env config to use the correct callback URL... callbackURL: '/api/auth/facebook/callback' Perhaps this is the cause of @benmarten issue.

@benmarten
Copy link
Author

indeed. that fixes the issue also for me. so basically only uncommenting local.js solved it...

@lirantal
Copy link
Member

Great, so this is good to merge.
Thanks for testing and feedback guys.

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

Successfully merging a pull request may close this issue.

7 participants
@lirantal @rhutchison @codydaig @ilanbiala @mleanos @benmarten and others