# Connect firebase

**URL:** <https://community.thunkable.com/t/connect-firebase/3170513>\
**Category:** Questions about Thunkable X\
**Created:** [September 1, 2024, 8:41pm UTC](https://community.thunkable.com/t/connect-firebase/3170513 "2024-09-01T20:41:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 1, 2024, 8:41pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/1 "2024-09-01T20:41:47Z")

</div>

Hello, I am making an app where certain features are unlocked with points. The fastest way to earn points is by watching a rewarded video ad, so I am using AdMob Rewarded Ads. I have placed the ads in my app, but I don’t know how to add points after the rewarded video ad is watched.  
points are stored locally but after sign out and sign in again points will gone so i want to connect these point to firebase how i do this?

---

<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:** [September 2, 2024, 10:02pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/2 "2024-09-02T22:02:09Z")

</div>

Hello @waqasbaloch88210ecsp  
Have you set up [Firebase sign-in](https://docs.thunkable.com/blocks/app-features/sign-in/sign-in)?

Firebase has its own identification system. Therefore, each user has a distinct ID, on Firebase. Once a user signs up through Firebase, an ID is generated (which is received upon logging in) and this ID must also be saved in a stored variable for future use.

You can set in the beginning 0 points for each user and change it when they watch a Reward Ad using the stored variable userid variable.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41154b3b48106347211e79a9b6054e06269f1537.png)

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 3, 2024, 2:20pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/3 "2024-09-03T14:20:36Z")

</div>

I already set up Firebase authentication in the app, and points are added locally, but not in Firebase. If the user signs out, the points will be reset to 0. I need the points to remain the same when users sign back in.

---

<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:** [September 3, 2024, 3:05pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/4 "2024-09-03T15:05:15Z")

</div>

Hi @waqasbaloch88210ecsp  
Thank you for sharing more information  
Have you tried to use the cloud variable block as it is in the screenshot?

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 3, 2024, 4:22pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/5 "2024-09-03T16:22:55Z")

</div>

I used it, but that’s the problem. I don’t know how to use these blocks properly. I’ve been trying to do this for many days, but I’m not understanding it correctly.

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 3, 2024, 4:31pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/6 "2024-09-03T16:31:33Z")

</div>

![Screenshot](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/9/99017396ac7649ce98ce88b2b669296dd5a45d11.png)  
 ![Screenshaot (1)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/9/7917d18fcbc14ea50f4c11c4fe47df49b8aa9a07.png)

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 3, 2024, 5:07pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/7 "2024-09-03T17:07:00Z")

</div>

![Screenshot (1)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/b/7bb4e2ef3e77d060800e8fc08280bd80627c720b.png)  
 ![Screenshot (1)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/4/44ba7ec266c27bd5ff1cb8d979c51d82fadcfdbd.png)  
i do this cloud showing but points not increasing it showing null

---

<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:** [September 3, 2024, 6:53pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/8 "2024-09-03T18:53:52Z")

</div>

Hi @waqasbaloch88210ecsp  
hHere it should change to cloud variable:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/f/5f588f47747b9f9e18afbd5af45e006b29c29d90.png)

And also add the symbol “/” on the text “Users/” and “/Points”

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 4, 2024, 1:28pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/9 "2024-09-04T13:28:05Z")

</div>

It’s still not working in the app. Sir, maybe you’re not understanding my question. It’s like a score in a game, but not an actual game. I just want to add scores to Firebase and have them show up in the app. It works locally, but not with Firebase. When I test with Thunkable Live, I earn a score, but the scores disappear when I sign out and sign in again.

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 4, 2024, 1:29pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/10 "2024-09-04T13:29:26Z")

</div>

how much score user earning if it also show in firebase thats great with user email i am confused

---

<div class="post-metadata">

**Author:** ![waqasbaloch88210ecsp](https://avatars.discourse-cdn.com/v4/letter/w/82dd89/32.png) [@waqasbaloch88210ecsp](https://community.thunkable.com/u/waqasbaloch88210ecsp)\
**Post date:** [September 4, 2024, 4:14pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/11 "2024-09-04T16:14:11Z")

</div>

![Screensftfhot (2)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fb6496468e7660495f33b256ddd2178840884fd7.png)  
 ![Screenshot (2)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/a/4ae284e971d1597c7474aa27e29226eeb3287dd1.png)  
I’ve tried many times, and with these blocks, the points are being added to Firebase. However, the main problem is that when I sign out and sign in again, the score resets to 0 in both Firebase and the app. Please tell me how to ensure that the points are added to Firebase and, after signing out and back in, the points are retrieved from Firebase, along with the email associated with the user who scored them.

---

<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:** [September 4, 2024, 6:33pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/12 "2024-09-04T18:33:58Z")

</div>

Hello @waqasbaloch88210ecsp  
Just to be sure that I understand, every user will have each one score.  
To do that you will need to include user id when you set the variable. The variable is a list of user ids and each user id has a field “points”.

Here are the blocks you will need to save the points:

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

Here are the blocks to present the points:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7cd5b9f09b74a47ad91f18aede0a59f83128d0a6.png)

No other blocks are needed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [December 3, 2024, 6:34pm UTC](https://community.thunkable.com/t/connect-firebase/3170513/13 "2024-12-03T18:34:36Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
