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

Add Facebook login to FTW #1364

Merged
merged 20 commits into from
Oct 15, 2020
Merged

Add Facebook login to FTW #1364

merged 20 commits into from
Oct 15, 2020

Conversation

OtterleyW
Copy link
Contributor

@OtterleyW OtterleyW commented Sep 22, 2020

This is a base branch for adding a Facebook login. On the high level this PR contains the following changes:

Generic:

  • New env variables REACT_APP_FACEBOOK_APP_ID and FACEBOOK_APP_SECRET. The Facebook app id must be exposed to the frontend (using prefix REACT_APP_) so that we can determine if the Facebook login should be enabled or not.
  • New cookies st-authinfo and st-autherror are used to store information. The expiration time for both cookies is 15 minutes.

Server:

  • New endpoints createUserWithIdp and loginWithIdp - for using these, you need the latest version of sharetribe-flex-sdk
  • Add Passport.js library for authenticating
  • Use Passport's Facebook strategy to authenticate with Facebook. New routes auth/facebook and auth/facebook/callback

AuthenticationPage:

  • Add button for logging in or signing up with Facebook and new function authWithFacebook
  • Add new ConfirmForm form confirming information fetched from the identity provider (IdP, e.g. Facebook)
  • Read information about loginWithIdp call from cookies

Button:

  • Add new variant for the social login button

CheckoutPage and ListingPage:

  • Add new parameter saveToSessionStorage to setInitialValues function so that we can store initial values to session storage before user is redirected to Facebook login. This enables redirecting user directly to CheckoutPage after authenticating from ListingPage

ContactDetailsPage and PasswordChangePage:

  • Add reset password link to the pages where the current password is required (e.g. updating email). When signing up with IdP (e.g. Facebook), the user doesn't have an existing password so they first need to create one by going through the reset password flow.

How the Flow works in FTW

Log in with Facebook
Social Logins   SSO@2x

Sign up with Facebook
Social Logins   SSO@2x (1)

This can be merged after the following parts have been completed:

@OtterleyW OtterleyW mentioned this pull request Sep 22, 2020
@OtterleyW OtterleyW force-pushed the social-logins branch 2 times, most recently from 528af30 to 927c290 Compare October 1, 2020 14:32
@OtterleyW OtterleyW temporarily deployed to sharetribe-starter-app October 14, 2020 07:32 Inactive
@OtterleyW OtterleyW temporarily deployed to sharetribe-starter-app October 15, 2020 07:11 Inactive
@OtterleyW OtterleyW changed the title Base branch: social logins Add Facebook login to FTW Oct 15, 2020
@OtterleyW OtterleyW merged commit c5843a2 into master Oct 15, 2020
@OtterleyW OtterleyW deleted the social-logins branch October 15, 2020 08:07
@@ -48,6 +53,10 @@ const initialState = {
// signup
signupError: null,
signupInProgress: false,

// confirm (create use with idp)
confirmErro: null,
Copy link

Choose a reason for hiding this comment

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

can I confirm, Is this a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@feorgie yes that's a typo, it should be confirmError. Thanks for letting us know!

Copy link

Choose a reason for hiding this comment

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

no problem!

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

Successfully merging this pull request may close these issues.

2 participants