Search code examples
firebasefirebase-authenticationfirebase-console

Firebase customize passwordless login email template


I'm trying to implement passwordless login into a Firebase app using their new email link login feature.

The problem I'm now having is that I want to change the template of the email that's being send to my users to not just be the default "We received a request to sign in to {{app}} using this email address" but I can't even seem to find the template anywhere.

It doesn't seem to appear among the other email templates in the "Templates" tab in the "Authentication" section of the Firebase console.

Is there any way to change this template or am I just stuck with the default wording of this email?


Solution

  • This is what we ended up with in the end:

    Google / Firebase do not allow this kind of functionality through their email servers. As far as I am aware, the reason for that is that they don't want the Firebase mail servers to be abused for sending spam.

    We worked around this by sending email verification and password reset emails ourselves.

    Firebase has an API in their Admin SDK for generating these links (see Generating Email Action Liniks).

    Our setup now has three cloud functions:

    • One triggered automatically whenever a user is created (see this cloud function trigger) and emails the user their verification email
    • One is simply triggered via an HTTPS POST request and sends the user an email for resetting their passwords.
    • The final one is also triggered via HTTPS POST whenever a user wants to login "passwordless". This cloud function works the same as the password reset one and just emails the link for login out to the user.

    In our case, e-mails are sent simply through Mailgun using their handy JS library but any other method of sending e-mail will work too, of course.