自定义Firebase电子邮件验证模板和操作处理程序
我想自定义电子邮件模板(使用触发电子邮件扩展模板)将验证链接发送给用户。
我知道,由于防止垃圾邮件,不可能从火箱控制台更改模板。
我知道可以自定义操作电子邮件处理程序的能力(用户在验证电子邮件中点击链接时登录的页面)以及手动更新Auth用户的EmailVerified
属性的能力。
是否还有一种生成Firebase将使用的验证链接的方法?具有以下属性的一个:
- 模式
- oobcode
- apikey
- conluturl
- lang
我的理想解决方案是在使用生成的验证链接注册后将自定义模板发送给用户。将用户直接进入自定义处理程序页面,并使用applactionCode()
函数,如 docs 要验证电子邮件(我希望此隐含地更新emailverified
属性属性 auth.user 记录。)
I would like to customize the email template (using the Trigger Email extension templates) to send verification links to users.
I understand it is not possible to change the template from the Firebase console as it prevents spam.
I am aware of the ability to customize action email handlers (The page that the user lands on when the link in verification email is clicked), as well as the ability to update the auth user's emailVerified
property manually.
Is there also a way to generate the verification link that firebase would have used? One with the following properties:
- mode
- oobCode
- apiKey
- continueUrl
- lang
My ideal solution is to send a custom template to the user upon registration with the generated verification link. Direct users to a custom handler page, and use the applyActionCode()
function as shown in The Docs to verify the email (I hope this implicitly updates the emailVerified
property on the Auth.User
record.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过创建用户并使用管理 SDK 在后端生成链接来实现这一目标。
因此,您的前端将调用可调用函数或定制 API 端点来进行注册,而不是直接使用 SDK。
可调用的内容如下:
auth.setCustomUserClaims
您将需要一个 ESP,例如 Sendgrid、MailChimp、MailGun 等来完成最后一步。在那里您将可以自由地构建自己的模板。
请注意,
generateSignInWithEmailLink
将负责验证电子邮件地址和登录。因此它可以用于登录和注册。干杯
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:
auth.setCustomUserClaims
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