使用Firebase自定义的电子邮件验证成功页面 [英] Customized email verification success page using Firebase

查看:68
本文介绍了使用Firebase自定义的电子邮件验证成功页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用默认的Firebase功能生成电子邮件验证.默认的电子邮件验证成功页面如下所示:

我想在成功验证电子邮件后自定义响应页面.有办法吗?

解决方案

我想在成功发送电子邮件后自定义响应页面确认.有办法吗?

是的,正如弗兰克(Frank)在上述评论中指出的那样,有可能和

2.通过Cloud Function(或您拥有的服务器)发送电子邮件.在这种情况下,您需要:

a/调用 Admin SDK的generateEmailVerificationLink() 方法,该方法返回链接

b/生成包含此链接的电子邮件

c/通过您控制的SMTP服务器或通过Mailjet或Sendgrid之类的微服务将电子邮件发送给用户


您可以看看以下其他答案:

I want to customize the response page after successful email verification. Is there a way to do that?

Yes, as Frank indicated in his above comment, it is possible and the documentation he refers to explains the mechanism.

As explained in this doc (and also in my other answer :-) ), you need to build a web page in which you will:

  1. Get the values passed as QueryString parameters (e.g. mode or oobCode)
  2. Call, from this web page, the applyActionCode() method of the Firebase JavaScript SDK, passing the values of these parameters to the method.
  3. Upon successful verification, do something, like redirect the user to your app login page.


What's important to note is that you have two ways to generate the email sent to the user (which contains the link to the page described above):

1. Rely on the default Firebase mail mechanism. In order to customize the URL of the verification link (e.g. you want to redirect to https://www.myrapp.com/emailVerifyScreen) you need to change the base URL as shown in the below image ("Customize action URL"). Also explained here in the doc.

2. Send the email through a Cloud Function (or through a server you own). In this case you need to:

a/ Call the generateEmailVerificationLink() method of the Admin SDK, which returns a link

b/ Generate an email containing this link

c/ Send the email to the user (via an SMTP server you control or via a microservice like Mailjet or Sendgrid)


You may have a look at these other answers:

这篇关于使用Firebase自定义的电子邮件验证成功页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆