简体   繁体   中英

How to customize firebase action URL for password reset and email verification?

I'm new to firebase and I Want to know how to customize action URL for the password reset and email verification mail.

For Example https://app.firebaseapp.com/__/auth/action // here I Don't want firebaseApp.com. So how to do I Customize this action URL from firebase.? Please help me as I am new to firebase. any help would be appreciated

if you want to change or customize default action firebase URL: https://app.firebaseapp.com to https://your_domain.com .

You just need to create a Firebase Dynamic link of your custom domain or part of your website and you're done. After Creating Firebase Dynamic Link, go to Authentication/Templates on Firebase, and click on Customize URL of your action link and type your Dynamic Link and hit done. Your Default Action URL link has been changed.

More information please visit https://firebase.google.com .

I know it's an year old question now, but this is the correct answer. Custom Email Handler Docs . Simply customizing that URL wont help as it's just half of the work.

您可以参考 Firebase 支持文章https://support.google.com/firebase/answer/7000714?hl=en 中的“自定义发件人域”部分

I believe i've found a way to accomplish this without the need to create your own webpage.

First go to your Firebase Console and then Firebase Hosting. Create a unique subdomain like verify.yourdomain.com or app.yourdomain.com . Redirect that domain to your project's default domain.

verify.yourdomain.com redirects to default-1234.firebaseapp.com .

Once Firebase verifies your subdomain after some time, it should be labeled as connected. Then within the console go to Authentication and then Templates. Replace the default domain within the action handler to your new subdomain.

https://verify.yourdomain.com/__/auth/action .

That should be it.

This is an issue I've had to scramble the internet to fix a good number of times now. This is unfortunately the case because there's no specific Firebase documentation for it.

Here are the steps to follow:

  1. Login to the firebase console, then go to the dashboard of the firebase project in question.
  2. Click the "Hosting" nav on the sidebar
  3. Click the "Get Started" button on the hosting page.
  4. A set up wizard will show up, but keep clicking "Next" without paying any mind to the instructions on the wizard
  5. When you're done clicking through, the actual "Hosting" page will show-up. Click the "Add custom domain" button.
  6. Follow through with the pop-up to add and verify your custom domain name.
  7. Once that is done, click the "Authentication" nav on the sidebar
  8. Click the "Templates" tab on the Authentication page.
  9. Now you can edit each email template by clicking the pencil button and then scroll down to click the "customise action url" button.
  10. Replace the domain name of the action URL with your custom domain (which you verified on step 6) and save it. Note, you are only replacing the domain name of the action URL. The path of the action URL should remain the same.

That's it you can now test that it's working by sending a "password reset" email or "account verification" email to yourself.

For a more detailed guide on the steps to follow, you can read this article that I wrote about it https://ifedapo.com/posts/customise-firebase-action-url .

It contains screenshots and more elaborate steps to follow so you might rather find it more helpful if the steps above seem too crammed up for you.

如果您使用支持合成记录(例如 Google Domains)的 DNS 注册商,您只需使用支持 SSL 和路径转发的合成记录即可完成此操作。

I don't know if there is any drawbacks with this (it's working for me), but the simplest way, if you are already using a custom domain in your app, is to just change the domain in the custom URL in the email template.

For example, just change https://myapp.firebaseapp.com/__/auth/action to https://myapp.com/__/auth/action in the template configuration, considering that you have already configured myapp.com to be your custom domain in firebase hosting.

No need for dynamic links, redirects or even to create a subdomain in your DNS!

Say, your firebase link is https://myapp.firebaseapp.com/__/auth/action You want it https://auth.mydom.com/__/auth/action

  1. Create a CNAME in your domain(mydom.com) with the Name as auth and the Value as myapp.firebaseapp.com

  2. Then go to your Firebase Project -> Authentication -> Templates tab on top of the page -> click on pencil button -> customise action url on the bottom -> Replace https://myapp.firebaseapp.com/__/auth/action with https://auth.mydom.com/__/auth/action

That's it.

As of August 2022, the solution for this is to load the "Authentication" product of Firebase in the console ("Authentication" is under the "Build" product category on the left side or can be found in "All products"):

左侧导航中的认证产品

Then select the "Templates" tab in the Authentication screen:

在此处输入图像描述

Select any of the Email templates (like "Password reset") and click on the Pencil icon to edit:

在此处输入图像描述

Click on the "Customize domain" link under the disabled domain name field: 在此处输入图像描述

Add your custom domain name (which you already own and have DNS control over) in the dialog box that appears:

在此处输入图像描述

(If the "Continue" button is disabled after typing in the domain name, make sure you click outside of the text input box. The "Continue" button should then be active.)

The next dialog box will provide DNS records that need to be added/updated. There should be two TXT records (av=SPF and a firebase record) and two CNAME records (two mail records). Update those on your DNS and then return to the Firebase Console to click on "Verify". Google may be able to see and verify the new records immediately or it may take some time (they claim up to 48 hours, but if it takes that long, it is possible a mistake was made).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM