firebaseui-web-react icon indicating copy to clipboard operation
firebaseui-web-react copied to clipboard

emailLinkSignIn not working

Open gr-qft opened this issue 3 years ago • 1 comments

When setting firebaseAuthConfig (to be given to StyledFirebaseAuth), if emailLinkSignIn is set and url inside it is defined, the sign-in is not successful, in the sense that clicking the email link won't sign the user in (and the signInSuccessWithAuthResult callback is not invoked --- this is where I set cookies and only if the cookies are set can a user be identified as having signed in). If I don't set emailLinkSignIn then everything is working fine.

What could be the problem, and how could it be fixed?

P.S. Just a note that when I have emailLinkSignIn set, I do see the url is visited but somehow the sign-in is not successful.

Another note: if I'm already signed-in, then including emailLinkSignIn and going through a new sign-in (an email is entered, the link is clicked) will send me to the url inside emailLinkSignIn successfully.

Updated: I've found out that if url points back the auth (it's where I ask for the emails) then it will be a success. I don't understand the current behaviour or if I'm using it correctly. Any help will be appreciated.

Thanks!

gr-qft avatar Oct 25 '20 16:10 gr-qft

@gr-qft did you manage to get email link signin working? I setup the provider as follows but for me it doesn't successfully sign in

{
  provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
  // Use email link authentication and do not require password.
  // Note this setting affects new users only.
  // For pre-existing users, they will still be prompted to provide their
  // passwords on sign-in.
  signInMethod: firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD,
  // Allow the user the ability to complete sign-in cross device, including
  // the mobile apps specified in the ActionCodeSettings object below.
  forceSameDevice: false,
  // Used to define the optional firebase.auth.ActionCodeSettings if
  // additional state needs to be passed along request and whether to open
  // the link in a mobile app if it is installed.
  emailLinkSignIn: function() {
    return {
      // Additional state showPromo=1234 can be retrieved from URL on
      // sign-in completion in signInSuccess callback by checking
      // window.location.href.
      url: 'http://localhost/auth/',
      // Custom FDL domain.
      // dynamicLinkDomain: 'example.page.link',
      // Always true for email link sign-in.
      handleCodeInApp: true,
      // Whether to handle link in iOS app if installed.
      // iOS: {
      //   bundleId: 'com.example.ios'
      // },
      // // Whether to handle link in Android app if opened in an Android
      // // device.
      // android: {
      //   packageName: 'com.example.android',
      //   installApp: true,
      //   minimumVersion: '12'
      // }
    };
  }
}

maerzhase avatar May 07 '21 12:05 maerzhase