Home > Back-end >  how to create FireBase new users with custom UID with flutter
how to create FireBase new users with custom UID with flutter

Time:02-16

I've been trying to create a new user in firebase with a custom UID in flutter, but it seems it only can be done using FireBaseAdmin package, and it hasn't been implemented yet in flutter. Is there's any possible way to create a new user with custom UID?

I have no background on native development, so it's not possible for me to implement the admin methods in native java or kotlin in the current time. any one has an idea on how to implement it?

CodePudding user response:

You can use FirebaseAuthentication.

When a user create an account it will create a new user with a random UID and the UID will be unique. I assume that you can also specify you own UIDs

Here is the link : https://firebase.flutter.dev/docs/auth/usage/

Its very easy to use :p

CodePudding user response:

The UID for a user is determine by the authentication provider that creates the user. There is no way to specify your own UID when calling to the existing providers in the client-side Firebase SDKs (such as the FlutterFire libraries).

If specifying your own UID for a user is a hard requirement, you can implement a custom provider. This does involve writing code to create a custom ID token that runs in a trusted environment (such as your development machine, a server that you control, or Cloud Functions) however.

Alternatively, you can also consider storing a mapping from Firebase-provided UID to the ID that you want to use to refer to that same user. This is a scenario regularly used to give users a unique name, so I recommend checking out questions related to unique user names.

  • Related