How to provide user login with a username and NOT an email?

前端 未结 4 1746
我在风中等你
我在风中等你 2020-11-27 17:39

I\'d like to use Firebase for my web app that is for people with dementia in a care home. They do not have email or social network accounts so will need a simple username /

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 18:34

    You are correct that username/password sign-in is not supported natively in Firebase Auth at this moment.

    You can implement a custom provider as shown in this example. This allows you to meet any custom requirements, but is admittedly a bit more involved than using the built-in providers. There is an example of this here that you can use as a starting point.

    A workaround you could take without needing to use custom auth with another backend is to accept usernames in your UI, but on the underlying logic, append "@yourowndomain.com" before calling the functions to sign up or sign in with email.

    So you would be using email/password authentication, mapping to @yourowndomain.com

提交回复
热议问题