How to send email verification after user creation with Firebase Cloud functions?

后端 未结 5 916
遇见更好的自我
遇见更好的自我 2020-12-18 06:46

I\'m trying to send the verification email after the user is created. Since there\'s no way on Firebase itself, I\'m trying it with cloud functions.

I cannot really

5条回答
  •  被撕碎了的回忆
    2020-12-18 07:07

    There are two possibilities to send an "email verification" email to a user:

    1. The signed-in user requests that a verification email be sent. For that, you call, from the front-end, the sendEmailVerification() method from the appropriate Client SDK.
    2. Through one of the Admin SDKs, you generate a link for email verification via the corresponding method (e.g. auth.generateEmailVerificationLink() for the Node.js Admin SDK) and you send this link via an email sent through your own mechanism. All of that is done in the back-end, and can be done in a Cloud Function.

    Note that the second option with the Admin SDKs is not exactly similar to the first option with the Client SDKs: in the second option you need to send the email through your own mechanism, while in the first case, the email is automatically sent by the Firebase platform

    If you'd like that ability to be added to the Admin SDK, I'd recommend you file a feature request.

提交回复
热议问题