Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Automatically delete inactive users from Firebase Auth

I like to automatically delete the user authentication and user info in the database if they have not logged in for say,a month or a year. This is to prevent inactive accounts from taking up space in Firebase.

Is there any way to do that.

like image 703
Asuwathaman R C Avatar asked Apr 09 '26 21:04

Asuwathaman R C


1 Answers

You will need two things:

  1. Create a way to identify old user accounts. You can store a timestamp in your database that records the time of last activity of that user.
  2. Write some backend code to query for and delete the accounts.

#1 might require some code in your app to write the current time every time the user launches the app.

#2 requires that you use use the Firebase Admin SDK to delete user accounts that you discover using a query for data that you created in #1.

If you do not have data from #1, you will have to list all user accounts using the admin SDK, then figure out which ones need to be deleted.

like image 132
Doug Stevenson Avatar answered Apr 11 '26 13:04

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!