# Firebase - security rule settings

**URL:** https://community.thunkable.com/t/firebase-security-rule-settings/1467301
**Category:** Questions about Thunkable X
**Tags:** firebase
**Created:** [August 24, 2021, 8:37pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301 "2021-08-24T20:37:19Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 24, 2021, 8:37pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/1 "2021-08-24T20:37:19Z")

</div>

Hello everybody!  
My questions may seem stupid - but I’m just starting to understand the development, so I hope for your understanding and support.

For my application to work, I created a firebase base. After that, I connected the authorization extension to it (currently I use email authorization, but later plan to use SMS authorization).

In the control panel of the firebase, a notification began to appear that within the next two days all client requests to the database will begin to be rejected. This will continue until I establish secure rules for accessing the database.

Can you tell me what security rules I should use, given that only I access the database (from the control panel), and users are added only in the authorization module?  
Those. in fact, I only need firebase for the authorization module to work, I store and process all the data elsewhere.

---

<div class="post-metadata">

### Author: ![danibarzo16i718](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@danibarzo16i718](https://community.thunkable.com/u/danibarzo16i718)
#### Post date: [August 25, 2021, 3:12am UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/2 "2021-08-25T03:12:00Z")

</div>

hi @lavrynenko the simplest would be this:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/d/cdd7000f435953866b451fd81db7cb9a4bb701fe.png)

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 25, 2021, 6:35am UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/3 "2021-08-25T06:35:04Z")

</div>

When you start a new project in Firebase, the system will automatically insert a rule to allow access for one month. Delete that entry from the database rules and you should be fine.

---

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 25, 2021, 7:25pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/4 "2021-08-25T19:25:26Z")

</div>

Thanks! I configured the Firebase as you recommended - hopefully this helps.

---

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 25, 2021, 7:30pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/5 "2021-08-25T19:30:16Z")

</div>

Most likely I did something wrong, so I ask you to clarify how exactly this rule should be removed. I removed the entire text from the list of rules, but the system issued a notification: **Error saving rules - No data supplied.**

Now I have established the following rules (as advised by respected @danibarzo16i718):  
 ![rules](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db403f154778f1b000276c5df155f779c826d3ad.jpeg)

---

<div class="post-metadata">

### Author: ![danibarzo16i718](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@danibarzo16i718](https://community.thunkable.com/u/danibarzo16i718)
#### Post date: [August 26, 2021, 12:36am UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/6 "2021-08-26T00:36:22Z")

</div>

ok @lavrynenko , now is working fine?

---

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 26, 2021, 6:32am UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/7 "2021-08-26T06:32:27Z")

</div>

Currently everything is working fine, but I want to wait another day or two to be sure 🙂

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 26, 2021, 8:50am UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/8 "2021-08-26T08:50:08Z")

</div>

When you first create a project `Firebase` will ask you to choose between **Locked Mode** and **Test Mode**.

If you choose the **Locked Mode** you will get similar rules as suggested by @danibarzo16i718 which are the basic mode that requires authentication to use the database.

If you choose the **Test Mode** you will have rules like this

```auto
{
  "rules": {
    ".read": "now < 1632517200000", // 2021-9-25
    ".write": "now < 1632517200000", // 2021-9-25
  }
}

```

Which basically gives you access for one month. I update the number to have the access allowed for **ONE** year.

The problem with the **Locked Mode** is that you cannot try new apps with it unless you use the `Sign In` component in the app otherwise you cannot test it which, for me, sometimes it is over complication. So I have my test database that is open and I can quickly create any application and write to the database and when I want to give to the user, I change from test DB to production DB which they have to login.

This is just an explanation to understand why it is made this way.

---

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 26, 2021, 8:43pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/9 "2021-08-26T20:43:05Z")

</div>

Thanks for your explanation.  
Do I understand correctly that:

1. Is the date in Unix format?
2. If I create a date in Unix format, which will be two or three years away from the current date, for example, and enter this date into the rules, will this method work?

---

<div class="post-metadata">

### Author: ![lavrynenko](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lavrynenko/32/108213_2.png) [@lavrynenko](https://community.thunkable.com/u/lavrynenko)
#### Post date: [August 26, 2021, 8:46pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/10 "2021-08-26T20:46:45Z")

</div>

The question is caused by the fact that I have just received another reminder that the database will be blocked for access. Yesterday I applied the rules suggested by 3454 - but I’m not sure whether these rules have not been applied yet (according to the conditions - they take 24 hours to apply, if I remember correctly), or - I messed up something in the rules. So I’m looking for a further way out of the situation in order to leave the base open.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 26, 2021, 9:04pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/11 "2021-08-26T21:04:54Z")

</div>

Yes, you are correct in the issue of date representation. The access rules update immediately once you save the rules.

In my case, I add a year in the Unix date given. Remember, each day is 86,400 seconds or 86,400,000 milliseconds. Multiply it by 365 to get the number required to add it to the existing number so that your Firebase access will remain active for another year.

Remember that every function in the Firebase system has its own **rules** so you can set a specific rule for `Realtime DB` and a completely different rule for `FireStore DB`.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:17pm UTC](https://community.thunkable.com/t/firebase-security-rule-settings/1467301/12 "2024-11-08T13:17:16Z")

</div>


