firebase admin SDK create user and send verification email

前端 未结 4 1823
不思量自难忘°
不思量自难忘° 2020-12-05 11:52

How can I send a verification email after I create a user with firebase admin SDK? I am trying to combine createUser function and sendEmailVerification function could somebo

4条回答
  •  死守一世寂寞
    2020-12-05 12:12

    According to firebase, the admin-sdk does not currently support this feature. See their response here: https://stackoverflow.com/a/44557980/8177355

    Whenever an email / password authentication user is logged in, and attempts to use a feature that requires authentication, I call onAuthStateChanged() and then check the user's record for email verification.

    If the email is not verified, and I have not sent a verification email before, I send it automatically. I return an error, asking the user to verify their email. (I store a variable in a profile setup for the user in firestore, to indicate whether it has been sent previously).

    On future attempts to use the app, if the email is still not verified, I return the same error, and also include a button in the error labeled "re-send verification email" that triggers sending of the verification email when pressed. (This way I am not automatically sending tons of verification emails every time the user tries to do something.)

提交回复
热议问题