Edit Templates Authentication Firebase

Change the email template when using Firebase email link authentication

You cannot, Firebase prevent this in order to avoid being used for spam. If you want to change the email, you need to handle the flow by yourself.

More info/references:

  • https://stackoverflow.com/a/50077575/5869296

Firebase customize passwordless login email template

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.

Edit templates Authentication Firebase

As it says when you hover over the question mark icon: "To help prevent spam, the message can't be edited on this email template". There is nothing we can do about that here on Stack Overflow, but if you'd like to see the functionality changes, I recommend you file a Firebase feature request.

Customizing Firebase Authentication password reset template theme color

It sounds like you're looking for how to customize the email action handler. There is no specific setting to change just the primary color, but if you think that'd be a useful feature to add, I recommend filing a feature request.

Custom Firebase Email Verification Template and Action Handler

I have achieved this by creating the user and generating the link on the backend with the admin SDK.

So your frontend would call a callable function or bespoke API endpoint for instance for the registration instead of using the SDK directly.

The callable would go about this:

  • Creating the user in Auth: auth.createUser()
  • Creating the user in your DB (Firestore, Mongo etc.)
  • Assigning custom claims if required: auth.setCustomUserClaims
  • Building the link for signin: auth.generateSignInWithEmailLink()
  • Sending the email to an email transactional API

You will need an ESP e.g Sendgrid, MailChimp, MailGun etc. for the last step. There you will have all the freedom to build your own templates.

Please note that the generateSignInWithEmailLink will take care of verifying an email address and signing-in. It could therefore be used for login and registration.

Cheers



Related Topics



Leave a reply



Submit