Firebase token.email_verified going weird

前端 未结 1 1905
猫巷女王i
猫巷女王i 2020-12-18 23:56

Ok so im making a blog which requires users to login through firebase. To post comments, their email has to be verified

I know how to verify the email, and i did so

1条回答
  •  醉梦人生
    2020-12-19 00:07

    This is what is likely happening:

    firebase.auth().currentUser.emailVerified is updated when firebase.auth().currentUser.reload() is called after verification. However auth.token.email_verified gets its value from the ID token which will not get updated until it gets expired or you force refresh. So you may have to call firebase.auth().currentUser.getIdToken(true) to force refresh to update the token claim which is sent to the Firebase Database backend.

    0 讨论(0)
提交回复
热议问题