Securing Firebase Realtime Database

I have been stuck in an issue for more than a month. I am getting FirebaseError: Permission denied error even the user is properly authenticated with Email and Password. I want to learn about securing the database with proper rules. Please help me.

Hi dear,

Welcome to the :kodular:odular Community!

I’m very sorry about your one month stuck, but I really appreciate your perseverance, that’s the right spirit!

Since you didn’t specify whether you were using an extension, I’m assuming you’re using the native components.

Unfortunately, at the moment it’s not possible to use them with rules enabled because Firebase_Authentication and Firebase_Database do not communicate with each other, and the requests made through Firebase_Database are not authenticated even if you logged in with Firebase_Authentication.

There are several extensions that allow this,
https://community.kodular.io/search?q=firebase%20%23extensions

or as I always recommend to everyone, you can follow this excellent guide by :raising_hands:Tim:raising_hands: that explains perfectly how to use the Web component for both authentication and the RealtimeDatabase.

(in my opinion it’s the best approach because it lets you manipulate the data as you like and it also provides extra features compared to the extensions)

Thanks for the reply. I will choose the way of web components.

Thank you very much!

Make sure your Firebase Realtime Database rules are set so that read/write require authentication. Also double-check that your app’s sign-in flow works properly before you try to access data.

If possible, avoid using default “open” rules in production — only allow access to users who you trust or who are logged in.

1 Like