Search code examples
javascriptfirebasefirebase-authenticationemail-verification

Firebase email-verification with temporary password


I have an React app where sport teams can sign up. A team has a coach, and that coach should be able to invite members of his team via e-mail.

I already setup the creating of team members by the coach through a form where a temporary password is set

onSubmit of the form I call

    auth.createUserWithEmailAndPassword(data['email'],
      generateRandomPassword()) 
    .then(user => user.sendEmailVerification())

This is all well and working like a charm, but I cannot seem to figure out a hack that enables me to send the password with the email since the editing of the email template is greyed out in "Firebase Console".

Can anyone figure out a way to resolve this other than the coach informing each members of their respective password?


Solution

  • I'd instead send a password reset email, which contains a token that allows the recipient to reset the password. That means you can safely assume that a user who signs in has received this email and this verified their email address. So you can use the Admin SDK to set their emailVerified property.