用户名身份验证而不是电子邮件 [英] Username authentication instead of email

查看:49
本文介绍了用户名身份验证而不是电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助 Firebase,我可以使用电子邮件地址注册和登录用户.但是,如果我希望应用程序基于用户名怎么办.例如,您会使用Bobzilla"而不是Bob@mail.com"登录?

With Firebase I can sign up and login users using email addresses. However what if I want the app to be username based. For example, you would log in with "Bobzilla" instead of "Bob@mail.com"?

Firebase 可以做到这一点吗?

Is this possible with Firebase?

推荐答案

Firebase 身份验证中没有内置的默认用户名+密码提供程序.但您可以使用 Firebase 文档中的说明.这需要在受信任的环境中运行的代码,您可以使用自己的服务器或 Cloud Functions for Firebase.现在甚至有一个在functions-samples repo中的例子.

There is no default username+password provider built into Firebase Authentication. But you can create your own custom identity provider using the instructions in the Firebase documentation. This requires code that runs in a trusted environment, for which you can use your own server or Cloud Functions for Firebase. There is now even an example of this in the functions-samples repo.

或者:您可以使用内置的电子邮件+密码提供程序,只需在用户名后面添加任何域即可.因此,一旦您确定了用户名,请使用 @vikzillasapp.com 注册您的用户.

Alternatively: you can use the built-in email+password provider and simply add any domain behind the username. So once you have determined the user name, register your user with <username>@vikzillasapp.com.

请注意,如果用户忘记密码,这将使他们无法重置密码,因为 Firebase 使用电子邮件地址发送密码重置电子邮件.

Note that this will make it impossible to for the user to reset their password if they forget it, since Firebase uses the email address to send the password reset email.

这篇关于用户名身份验证而不是电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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