how to get the user ID without firebase authentication? - firebase

I'm working on a flutter app that doesn't require an email or password to sign in, it only requires the user to enter his name
my question is, how can I deal with the user data and use his user id without firebase authentication?
is that possible?

If you want to be able to identify a user without requiring the to enter credentials, consider using Firebase's anonymous authentication. You can then store data in your database associated with that anonymous user's UID.

Related

create Firebase account without email and password?

I want to create accounts via Firebase that only create a UID of the user. No password and no email should be requested. The user should be able to delete the app and if he downloads it again, still be able to access his UID and the associated data. In addition, this registration should never expire and the UID of the user should always remain unique and not be overwritten.
Is there a tool in Firebase that can be used to do this?
What you're describing is known as an anonymous account in Firebase, and you can create one with a single call as shown in documentation for iOS, Android, and Web.

UPDATED : flutter sign in with realtime database firebase [duplicate]

Is it possible to implement Firebase Authentication with Username And Password
(not email and Password) in Flutter? Is there a way to do it with the Firebase Auth Plugin?
Logically you can control email address
I mean if you want you can maintain email address pattern and store the username for the created UID .
Example :
Var currentTimeStamp:
CurrentTimeStamp#gmail.com
No Need to verify the email address as you need only the UID
Then you have to store the UID ,email address ,along with username in the Firestone or real-time database so that user can login again with the user name .you have to check user name and password is correct or not then do signin with that email addrsss and the given password
Thanks
It’s just an idea
No, FirebaseAuth only supports sign in with email and password. There are no usernames unfortunately.
Currently there is no way to use the default FirebaseAuth to sign in with a username.
But email + password login is much more secure because if you want to try and brute force a user you have 2 missing pieces of information instead of one.
Actually there is a way from the start offered by Firebase. It is by using Custom Auth Tokens (link).
But this is most suitable when you have complete custom server/backend and only want to use Firebase Authentication to handle the authentication.
You will need to create custom auth tokens using the user's user id and password. This can only be done by Firebase Admin SDK (link).
That means this approach needs some kind of server. You can use Google cloud functions or AWS lambda for some cheap options.
Then in order to use the authenticated users, you'll need to implement a function to verify these tokens (link). This gives the UID of the user.

Firebase authentication without email

Currently, I am trying to develop a web portal where I want to allow specific users to enter in the site. This means I want to use specific username and password to enter my side without using any email address. How it is possible? I see that for custom login I have to use an authentication server and it is allowed in the Functions tab in Firebase. But I have to purchase it. Is there any workaround available to create my custom login without an email.?
Firebase Authentication has no username-password authentication. The best you can do is whenever user enters the user name you can append #yourapp-com to make the format like an email and use it with the password.
Use the same method when user tries to login, when they enter their username, append with that domain and use signInWithEmailAndPassword method. So technically you are using email and password (but the email cannot receive emails) but your users enter username and password only.
That was the easy work around but you can also store usernames and passwords in database. However make sure you properly hash the password in the database. You can use cloud functions to authenticate user. The auth flow would be like:
User enters username and password
A cloud function is triggered which then verifies the username and password
If the password matches, use the Admin SDK to generate a Custom Token and send it back to client
Use the signInWithCustomToken method and log the user in with that token.

Firebase, prevent user sign up by email password and google

I'm using Flutter and Firebase.
I allow new users to sign up using Email and Password, and also Apple and Google sign in.
Now I need to prevent the same user from creating an account with Email and Password, and a different account with Apple/Google sign in. As it is currently, they can create two accounts, and I see two different accounts in the Firebase console. Is there a way to make sure that once a user signed up with one method, he cannot sign up with another method? For example, check if that email already has a user associated with it?
Thanks

Does the firebase user uid change if the user is signed out of the app when using email authentication?

I have to implement firebase email authentication and want to store data with a field of firebaseUser.uid in that. I want to know if there is any case when the user's uid will be changed so that I don't mess up with the user data as I will be referring it based on the user's uid. So if any user signs up using an email id, it's uid should never change unless he logs in again with a different email.
The UID for a user is assigned randomly and never changes within that project.

Resources