Firebase email verification behavior

为君一笑 提交于 2020-08-19 07:47:39

问题


I've got a question about how firebase email verification work.

Case:

  1. My user signed in my site (using device A).
  2. They create another account using other browser or device (device B), but they open email verification link with browser and device which he is already signed in (which is device A).

What happened to the already signed in user (in device A)? Is firebase signed them out or just verify new email, but still signed in with the current user?


回答1:


The email verification occurs out of band and would not affect any existing firebase states until it is reloaded. If a user verifies their email, you have to call firebase.auth().currentUser.reload() to update the emailVerified property. If you are using firebase rules with emailVerified field, you need to force a token refresh (firebase.auth().currentUser.getToken(true)) after verification. You can use the Firebase realtime database to set some flag on email verification and detect it in the existing session to force a user reload. This would require you build your own custom email verification handler: https://firebase.google.com/docs/auth/custom-email-handler



来源:https://stackoverflow.com/questions/41326951/firebase-email-verification-behavior

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!