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

Facebook authentication #842

Merged
merged 2 commits into from
Aug 25, 2015
Merged

Facebook authentication #842

merged 2 commits into from
Aug 25, 2015

Conversation

rhutchison
Copy link
Contributor

Closes #202, and closes #697 - if user does not authorize email scope, email will not be mapped. Username will be generated from first initial of first name and last name.

.jshint latedef set to nofunc.

…l not be mapped. Username will be generated from first initial of first name and last name.

.jshint latedef set to nofunc.
@rhutchison rhutchison mentioned this pull request Aug 23, 2015
15 tasks
@rhutchison rhutchison changed the title Facebook enhancements Facebook authentication Aug 23, 2015
current implementation does double redirect due to '#!'
@rhutchison
Copy link
Contributor Author

I have tested these changes but need additional eyes. If anyone is using facebook strategy please weigh in.

@simison @mleanos @codydaig @lirantal @ilanbiala @jcaspian @BenMartin

username = profile.name.givenName[0] + profile.name.familyName;
}

return username.toLowerCase() || undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if on 45 or 47 the username field:

  1. does not exist? meaning it's empty for some reason...
  2. does not fit to go through validation? for example, it's length is too short/long or uses special UTF8 chars
  3. already matches an existing username and then we'll fail on duplicate usernames

If we end up returning undefined, how would the call later to saveOauthUserProfile behave?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, take a look at

looks like it's already trying to figure out a username for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this, but it does not handle it as nicely. If there is no username, the app will not create a user, takes you to the login page. Email is not required and if you reject access to email, then the current implementation does not work. The case above is much more forgiving. profile.name will always be returned, because that is the absolute minimum when authenticating with facebook.

@mleanos
Copy link
Member

mleanos commented Aug 25, 2015

I've tested this, and it works for me; after updating my local env config to the correct fb callbackURL... callbackURL: '/api/auth/facebook/callback'

I still don't fully understand the implementation here though. I'll go through it thoroughly.

@lirantal lirantal self-assigned this Aug 25, 2015
@lirantal
Copy link
Member

Great, merging.
Thanks @rhutchison!

lirantal added a commit that referenced this pull request Aug 25, 2015
@lirantal lirantal merged commit 05355b9 into meanjs:master Aug 25, 2015
@rhutchison rhutchison deleted the fb-enhancements branch August 26, 2015 04:36
@ilanbiala ilanbiala modified the milestones: 0.4.1, 0.4.x Aug 31, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facebook Login is not Working passport facebook (facebook api v2 & email permission disallowed)
4 participants