Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for username authentication #580

Closed
anvarik opened this issue Apr 28, 2019 · 5 comments
Closed

Support for username authentication #580

anvarik opened this issue Apr 28, 2019 · 5 comments

Comments

@anvarik
Copy link

anvarik commented Apr 28, 2019

It's been years and still, Firebase won't support username authentication... Any chance to consider this at some point?

In the interim what would be a good and secure approach to pass usernames along with Firebase's email authentication?

  • I couldn't find a way to tweak First & Last Name prompt to be a username. I did manage to change the label, but then again I want unique usernames across my app so I need validations on that, also can't see where first/last names are actually stored in Firebase. When I check the Authentication tab only emails and uids are displayed. Did anyone manage to tweak the ui code to support usernames?
  • I can make requireDisplayName: false and then let the user register with email and password and then redirect for a page where the user enters a username. But not sure whether that's good user experience.
  • Or I guess I can simply not use firebaseui and simply go with createUserWithEmailAndPassword and add 3 inputs, and in callbacks update my new users collection to store uids that I retrieve from auth along with the usernames that are entered.

I feel like if we can configure the display name and change the label without modifying firebaseui code, and can enforce the display name to be unique that would solve my problem. I just wanted to get some feedback on what community thinks about these options, any examples are welcome.

@anvarik anvarik changed the title Username auth Support for username authentication Apr 28, 2019
@bojeil-google
Copy link
Contributor

FirebaseUI is unlikely to support username / password until it is supported in the underlying firebase-auth library. You will need to build that on your own. I have seen multiple approaches online for this.

  1. Using realtime database or Firestore to store a mapping from username to email. When a user enters their username, you get the corresponding email and signInWithEmailAndPassword.
  2. Another approach is to add a dummy domain name to the username username@my-project-id.firebaseapp.com and then call signInWithEmailAndPassword. The downside is that there will not be a recovery email for the user.

You can learn more about this on stackoverflow. In general, I don't recommend usernames as you will always need to ask the user for their email for recovery purposes (if you forget your password with username sign-in then your account is lost) and to verify identities if needed. So you will end up asking the user for both a username and an email.

@cargallo
Copy link

The explanation given has no sense. There are lot of applications that manages users login with both alternatives at the same time, username or email login.

@dbacinski
Copy link

dbacinski commented Jul 20, 2021

We have a use case of migrating WordPress users to Firebase. WordPress both support authentication with email and username, but Firebase just offers emails, which can be a "deal-breaker".

@annzimmer
Copy link

We don’t support this out of the box because 1. it would be more susceptible to abuse than using, for example, a trusted email provider or any of the OAuth2 providers and 2. the password recovery flow would be broken without an email for each user.

If you really need only usernames, could probably implement this using signInWithCustomToken, but make sure you have a solution for the two problems above.

@jhuleatt
Copy link
Collaborator

This is not something FirebaseUI can support unless it is implemented in the underlying product, Firebase Authentication. To file a feature request for Firebase Authentication, please post here: https://firebase.uservoice.com/forums/948424-general?category_id=464875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants