How to use 'get properties' block to separate users signing in?

I’m working on a project that requires two different kinds of users to sign in/up and the goal is for screens to be restricted based on who signs up and for an alert to show up and the user redirected to the screen they can enter.

Currently, to achieve that, I’ve assigned a cloud variable to the user ID automatically created when a user signs in with Firebase, and with that user Id variable, created an object with the field assigned with a true/false value in it. Every time a user enters a screen, whenever it opens, the code is supposed to identify whether that property in the object is true or false, and if it is not matching the value you need to have to get in to the screen, an alert is supposed to show and then redirect you to where you are allowed, like a profile screen. Here is the example code screenshot of what I have done. However it isn’t working, I am still able to move to the screens not allowed and an alert never shows up…

If anybody knows what the issue with the code is or has any other suggestions on how I could go about this as well, that is greatly appreciated.


The code when the T/F value is assigned to the user Id variable when they sign in ^^

The code that is meant to scan the value and send out the alert ^^

My guess is that you are sending a true value as a boolean from Thunkable but that Firebase is storing it as a text string. Have you tried checking if the “vendor” property is equal to “true” (a text string) instead of the [true] logic block?

1 Like

How do you suggest I do that, will I have to access my firebase or can I check through my thunkable project?

In Thunkable, just replace the [true] block with a string block. Type in “true” for the string.

Unfortunately that did not work. This is the new code:


Do you have any other suggestions on how to correct this issue?

Have you tried displaying the value of [get property “vendor” of object cloud variable app variable userID] in a label? What shows up when you do that?

Are you able to – using any blocks in Thunkable, not necessarily the blocks you have above – both change a value in Firebase and retrieve a value in Firebase? If not, your access rules could need adjustment in your Firebase console.

The value displayed is ‘null’ meaning the value changed when one of the screens opened is never initialized in the if-blocks.

My firebase does not show any values, changed or retrieved, however both the read and write rules are set to true. I’m thinking it is an issue with the way the values are retrieved and set through the blocks in firebase.

The first step when using Firebase in Thunkable is to make sure that you can read/write simple values.

  1. Have you configured your Firebase database settings in the Design tab of Thunkable?
  2. Are your Firebase Console rules set to give only authenticated users access? If so, are you signing in (successfully) to a Firebase account within Thunkable at runtime?

You’ll need to troubleshoot your sign in and rules before moving on to more complex ways of using cloud variables in Thunkable.

The main problem of my code was that the blocks were being called back as objects and I had to create a function to convert that object into json to identify substrings to set the labels and check with. Along with that, I was not able to see the data in my firebase so I had to alter the rules slightly. These are the blocks I used for the functions, and the same kind of blocks can work whenever you are calling data from firebase, the get object properties block won’t work for some reason on most of the data being called for me, so I created functions to work with that could call for it.

Hope that helps with anyone having the same problems!