# Firebase rules for authenticated users?

**URL:** <https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480>\
**Category:** Questions about Thunkable X\
**Tags:** firebase\
**Created:** [May 9, 2021, 4:10am UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480 "2021-05-09T04:10:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 9, 2021, 4:10am UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/1 "2021-05-09T04:10:27Z")

</div>

I’ve read a bunch of posts here and elsewhere about Firebase rules but I can’t seem to get them to work for me.

Here are the rules I am trying to use:

// Checks auth uid equals database node uid  
// In other words, the User can only access their own data

```auto
{
  "rules": {
    "posts": {
       "$uid": {
         ".read": "$uid === auth.uid",
         ".write": "$uid === auth.uid"
       }
     }
   }
}

```

I’d like to give a signed in user using this block access to only their stored data:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/3/2303f31e23a64744f78f73774ca8c4df4efbf09e.png)

But I think the problem is that there is no $uid created by the SignUp block in the legacy interface.

So how should I adjust the rules?

Here’s how my Firebase database looks:

```auto
[database name]
     -[email address]
          -journal
                -[timestamp]

```

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 9, 2021, 10:02am UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/2 "2021-05-09T10:02:56Z")

</div>

You just need to call the sign in block after sign up.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 9, 2021, 3:33pm UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/3 "2021-05-09T15:33:23Z")

</div>

I use the SignIn block on a separate screen and I can successfully login as a user I created. But the user doesn’t have access to any of the data in Firebase from what I can tell.

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 9, 2021, 3:41pm UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/4 "2021-05-09T15:41:37Z")

</div>

> [@tatiang](#):
>
> ```auto
> {
> "rules": {
> "posts": {
> "$uid": {
> ".read": "$uid === auth.uid",
> ".write": "$uid === auth.uid"
> }
> }
> }
> }
> 
> ```

What data are you trying to call (exact cloud variable path) and what exactly do your rules say?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 9, 2021, 3:59pm UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/5 "2021-05-09T15:59:16Z")

</div>

Okay, I think I got it. For some reason, I was overlooking the green UserID block because I initially didn’t need it. But once I secured my rules, I did need it.

---

<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:22pm UTC](https://community.thunkable.com/t/firebase-rules-for-authenticated-users/1271480/6 "2024-11-08T13:22:36Z")

</div>


