如何获取用于本地化目的的 oobCode [英] How to get oobCode for localization purpose

查看:12
本文介绍了如何获取用于本地化目的的 oobCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firebase 仅允许使用一种语言发送确认电子邮件.整个做工精良的产品对于多语言应用程序毫无用处.我想制作自己的确认系统.唯一的问题是我怎样才能得到这个在 firebase 中生成的 oobCode.site.com?mode=&oobCode=

Firebase allows only one language for confirmations emails. Whole nicely done products are useless for multi-language apps. I want to make my own confirmation system. The only question is how can I get this oobCode which is generated inside firebase. site.com?mode=&oobCode=

谢谢.

推荐答案

目前无法通过 Firebase Authentication API 生成有效的 oobCode 值.它只能在(如您所说的不可翻译")电子邮件中发送.

There is currently no way to generate a valid oobCode value through the Firebase Authentication API. It can only be sent in the (as you've said "non-translatable") email message.

但您可以根据需要构建自己的电子邮件验证机制,使用您自己的确认码来验证电子邮件所有权.你会:

But you can build your own email verification mechanism if you want, using your own confirmation code to verify email ownership. You'd:

  1. 在服务器上生成一个随机的、不可猜测的代码
  2. 将其发送到用户的电子邮件地址,然后
  3. 当用户点击确认链接时,在您回调的同一台服务器上拥有您自己的端点
  4. 此时您可以使用 Firebase Admin SDK 将 emailVerified 属性设置为 true.
  1. Generate a random, unguessable code on a server
  2. Send it to the user's email address and then
  3. When the user clicks the confirmation link, have your own end point on the same server that you call back to
  4. At this point you can use the Firebase Admin SDK to set the emailVerified property to true.

有关最后一步的示例,请参阅:https://firebase.google.com/docs/auth/admin/manage-users#update_a_user

For an example of the last step, see: https://firebase.google.com/docs/auth/admin/manage-users#update_a_user

感谢@Nikhil 在评论中:或者,您可以完全进行自己的验证,并使用 Admin SDK 将 emailVerified 设置为 true.有关示例,请参阅 Firebase 文档.

Thanks to @Nikhil in the comments: Alternatively you can roll your own verification altogether and use the Admin SDK to set emailVerified to true. See the Firebase documentation for an example of that.

这篇关于如何获取用于本地化目的的 oobCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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