Is there a way to send the verification email with the Firebase Admin SDK from my Node.js server?

前端 未结 3 1111
走了就别回头了
走了就别回头了 2020-12-19 00:13

Is there a way to send the email verification email from my server ?

This is how it\'s done on the client:

authData.sendEmailVerification().then(func         


        
相关标签:
3条回答
  • 2020-12-19 00:41

    You can use :

    axios.post('https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]',
        { requestType: 'VERIFY_EMAIL', idToken: response.data.idToken }
    )
    

    https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification

    0 讨论(0)
  • 2020-12-19 00:42

    firebaser here

    To my surprise there currently is no option to send verification email from within the Admin SDK. I'd recommend you file a feature request.

    What you can do from the Admin SDK is update a user profile to mark their email as verified. This allows you to take control of the entire verification flow if you want to, finishing with a call to admin.auth().updateUser(...) (on Node.js, see the link for other supported languages).

    0 讨论(0)
  • 2020-12-19 00:58

    I just came across the same problem as you. There is a function to generate the verification link using user's email address.

    I used this function on an array of email addresses, then load the result to my mail automation API to send mails out. This function is weirdly not documented:

    admin.auth().generateEmailVerificationLink([EMAIL_ADDRESS])
    
    0 讨论(0)
提交回复
热议问题