Albert
Albert

Reputation: 353

Firebase Anonymous user

I am programming an app that users will log-in to firebase anonymously,each login generate UUID , but I knew that UUID will change when the user clear the app cache or reinstall the app. how can I apply roles to each logged in user anonymously(PS: Users will never Login with user:password or Facebook just anonymously).

Since the security will be as follow:

   "root.child('users').child(auth.uid).child('paid').val() === true",
   ".write": 
   "root.child('users').child(auth.uid).child('paid').val() === true"

can I use other then auth.uid that i can link it to the anonymous user?

Thank you

Upvotes: 0

Views: 905

Answers (1)

Albert
Albert

Reputation: 353

I found a solution that when first time I register the user from the server I give him a unique ID , each time the user login from the phone, it will filter the node from that unique ID I already registered then checks if the CurrentUser.getUId is not equal of the key that already registered so I can delete the old node and update it with a new one.

Upvotes: 1

Related Questions