firebase / firebaseui-web-react

React Wrapper for firebaseUI Web
Apache License 2.0
1.26k stars 249 forks source link

EmailLinkSignIn - retrieve email used #88

Open scotty595 opened 4 years ago

scotty595 commented 4 years ago

Is there any way to retrieve the email used to send an email link without implementing a custom function/implementation of the firebaseui react?

i.e. it'd be great to have something similar to the below in the umailLinkSignIn callback:

emailLinkSignIn: function(email) {
   window.localStorage.setItem('emailForSignIn', email)
}

so we can avoid reprompting for the email.

bojeil-google commented 4 years ago

When the link is opened on the same device, we do not prompt the user to provide it again. We already cache the email locally in those flows.

scotty595 commented 4 years ago

perfect, once I changed the signInFlow from 'popup' to 'redirect' it started automatically logging in with the correct email address - thanks.

Still seems to be relevant if you have is set as popup signInFlow though.

have used the below in uiConfig as a workaround:

signInFlow: firebase.auth().isSignInWithEmailLink(window.location.href) ? 'redirect' : 'popup',

bojeil-google commented 4 years ago

I don't think signInFlow should affect this. signInFlow affects sign-in with IdPs like Google, Facebook, Twitter, etc with popup or redirect.

michaeldoaty commented 4 years ago

I'm seeing the same behavior. Changing signInFlow from popup to redirect fixed the issue.

niklaslavrell commented 4 years ago

I'm having the same (I think) issue. When using email link authentication and pressing the link in the email, the user won't get logged in when I have signInFlow set to popup. However if signInFlow is set to redirect, it works fine.

jmn commented 4 years ago

I had the same problem and it took quite a while to figure out. Setting signInFlow to redirect makes passwordless e-mail sign in work.