Firebase Auth: How to connect a custom domain for email templates
If you’re using Firebase Authentication in your app, you may be familiar with templates. There are different templates each for a different process in authentication. To be more clear, sample templates like:
Email address verification
Follow this link to verify your email address.
If you didn’t ask to verify this address, you can ignore this email.
Follow this link to reset your <MYAPP> password for your <EMAIL> account.
If you didn’t ask to reset your password, you can ignore this email.
EmailEmail address change
Your sign-in email for <MYAPP> was changed to <NEW_EMAIL>.
If you didn’t ask to change your email, follow this link to reset your sign-in email.
The problem here is “from” address of these email templates. The from address seems like email@example.com
This article is about turning the “from” address of templates firstname.lastname@example.org into email@example.com.
You can easily edit the “noreply” text. The tricky part is changing the domain and this article is going to explain especially that part.
1- Firebase Console
Sign in to Firebase Console and click Authentication menu item from the side menu.
Then go through to Templates tab.
You can see a string which seems like a random domain at “from” address, that is what we want to edit.
2- Edit the “From” address
Click the pencil image which is located at the right side of the From address. Then click to “customize domain” link.
There will be a pop-up windows which is about the setting up the domain. Write your own domain into the related box.
Right after the clicking Continue button, you will see domain registrar entries to finish the customization of the domain.
3- DNS settings of Domain
I bought my domain from GoDaddy. You may use another vendor but I don’t think there are huge differences. Now, you need to set up your DNS in order to fulfill the Firebase’s needs.
Recall the records at “Verify Domain” page above.
If you write the host names as Firebase says, you cannot make it work!
I don’t know why, but GoDaddy is not working as like as Firebase says. I found a solution on GoDaddy forums, it says “Do not write down your domain name part and use @ for entries which indicate your domain name only”. It is worked!
Then, you will see the Firebase console like below:
Click to the “Apply Custom Domain” button and refresh the page.
It is done!
Have a nice coding :)