Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to Firebase anonymous users?

I want to know what will happen to the users of my app that I used anonymous sign in method for them.

The Firebase documentation is really BAD and didn't explain everything and expect developer to find out himself. I found in its old version documentation that anonymous session will expires based on the expiration time has been set in Login & Auth tab, but even there didn't mention this means just the session ends or it means that user id will remove also from my app users list or what EXACTLY happened?

I found this answer but it really is not acceptable. The number of anonymous users will grow very very fast if you do a web app and make every thing hard. I even cannot see the number of my app users in my dashboard!!!!! So, what should i do? should i develop a dashboard for my data myself or Firebase team should do it? At least for managing users i should have more power than just searching user with their email and when you use custom login you cannot do this also.

like image 730
Ali Avatar asked Aug 01 '16 08:08

Ali


People also ask

Can you use Firebase without authentication?

To use the Firebase Storage we need to authenticate a user via Firebase authentication. The default security rules require users to be authenticated.

What is anonymous authentication?

Anonymous authentication gives users access to a website without prompting them for a user name or password. When a user attempts to connect to a public website, the web server assigns the user to the Windows user account called IUSR_computername, where computername is the name of the server on which IIS is running.

How are users counted in Firebase?

Sessions - The number of times a user started the app in the given day. Multiple times count as multiple sessions. Active Users - The number of users who interacted with the app by starting at least one session. Multiple sessions only count as a single user.


2 Answers

Anonymous users don't expire, and there isn't currently any automated way to purge them.

Firebase doesn't automatically remove them because it doesn't really know if a user is still storing data linked to that login - only the app creator does. Imagine if you are playing a puzzle game on your phone, and get to level 100. Then when you go to play level 101 next year, all progress is lost. Firebase can't just assume a user being inactive for a year means that the account can be removed.

There is a couple tools that should help, though.

1) Admin SDK & Firebase CLI list users.

2) Linking multiple auth providers

3) Auth State Persistence

Once you list your users, you can check that each doesn't have any other providers, and hasn't been used recently, doesn't have data stored, and delete them.

Better, though, would be to ensure that only one account is created per user. If you create an anonymous account to help users store data before logging in, you may want to consider prompting them to link a auth provider (like Google or email). If you link the account, rather than creating a new one, you'll avoid abandoned accounts from active users.

In general, you will also want to make sure to use auth state persistence to ensure that there aren't more accounts than necessary being created. Creating 1 account per new visitor, rather than 1 per time someone repeatedly visits your page, will significantly help keep user growth in check.

like image 87
Kiana Avatar answered Sep 28 '22 06:09

Kiana


In my case, I am using the anonymous sign-in method for authentication without the knowledge of the user. Each time when the user leaves the app, delete the anonymous user by -

FirebaseAuth.getinstance().currentuser?.delete() 

There will be no stacking up of anonymous user with this and limits the number of anonymous user in the app

like image 31
Anshul Garg Avatar answered Sep 28 '22 08:09

Anshul Garg