firebase / firebaseui-web-react

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

uiconfig.callbacks are not called for email link sign in method if onAuthStateChanged listener is registered #91

Open trtg opened 4 years ago

trtg commented 4 years ago

I am using provider: EmailAuthProvider.PROVIDER_ID with EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD and flow = redirect. I register a listener for onAuthStateChanged in componentDidMount and I have

uiconfig = { 
  callbacks: { 
     signInSuccessWithAuthResult: function(authResult, redirectUrl){
        console.log("called success callback");
         return false;
      }
   }
} 

(other parts of config skipped for brevity) The onAuthStateChanged listener will be called but the signInSuccessWithAuthResult callback will not. If I get rid of the listener, the callback is hit. This issue only applies to email link sign in- google, facebook, etc[ work fine and call both the listener and the callback.

I need the signInSuccessWithAuthResult callback to take actions that need to happen only once on signup, rather than every time the user logs in/refreshes the page, which is what onAuthStateChanged would get me.

@jhuleatt @wti806 This seems like it might be related to these other issues issues: #67 or https://github.com/firebase/firebaseui-web/issues/656 any thoughts?

@dankawka maybe related to the issue you called in #67 ?

francisrod01 commented 4 years ago

The same happen to my example where I try to set up the Twitter provider, the signInSuccessWithAuthResult isn't be called and nothing happens on the page, but if I log in with email/password it works.

Next.js examples - with-firebase-authentication https://github.com/vercel/next.js/blob/canary/examples/with-firebase-authentication

kyunez commented 3 years ago

Same here. Call back is not triggered for EMAIL_LINK_SIGN_IN_METHOD.

jekh commented 2 years ago

I just ran into this same issue, the email link sign-in method does not trigger signInSuccessWithAuthResult if an onAuthStateChanged listener is registered. The signInSuccessWithAuthResult callback is extremely useful when working with session cookies, or just in general when there are events triggered by sign-in, so it's unfortunate that you have to sacrifice onAuthStateChanged to use it.

Does anybody know if this is a bug in firebaseui-web-react, or is it an underlying issue in firebaseui-web?

AlexanderChiclana commented 2 years ago

Been having the same issue, except the callback isnt triggered when certain microsoft accounts log in

garvitkhamesra commented 2 years ago

Does anyone found a solution for this?

AntonioVentilii commented 1 year ago

up! same issue for GitHub provider