How to store cloud value of a key created during the app session

Hi everyone,

I have created a new user during the app session, with a key email. I also created an app variable ‘email’. Now, in the next step, I want to allocate a particular interest to that particular user. As you can see, the object is: universities/mailsac/users. But it should be universities/mailsac/users/app variable ‘email’ to identify the specific user, allowing for interest allocation only to that particular user. There is no block that I can add to do that. Any ideas?


1 Like

I’m having a little trouble understanding what you are trying to do.

I THINK you want to create a list of interests in the user object. If so you might try these options.

A few notes:

  • The text from list block is not necessary, but this is a handy trick @tatiang taught me to keep the code a little more readable as the hierarchy gets longer.
  • When working with Firebase, if you set a property to either an empty object or empty list, it will not display anyting in the viewer.
  • You might consider using the firebase userid to keep track of your users. Using this key prevents any issues with 2 “Arnolds” using your app.

Just to add to the valuable comments of @drted, if you mean you want to use the email address as the key in the database then the answer is “not allowed” because the @ is an illegal character in key names and therefore you cannot use the email address.

1 Like

This is how I keep user data secure! This plus the following rule set

      "BRC": {
      		".read": "$uid === auth.uid",
      		".write": "$uid === auth.uid"

This keeps all the data in that bucket readable and writeable for that user only

1 Like


Thanks for your message. I tried to implement what you suggested, but it did not add “partying” to the interest list which got initialised in the step before, but rather added it as key.
Also, I do not have the function block you show above with the userID. I think that is because I am using the new version is that possible?
Please let me know what you think about both.



Sorry, I wasn’t clear. The 2 examples work with lists in slightly different ways. The first example

can be used to create a list.

The second example

will add an entry to an existing list in firebase.

The firebase/Thunkable management of new/empty lists can be a little tricky. If you try to add an entry to an uninitilized list, Thunkable will crash rather than create a new list. How you check for an existing list and initilize it will depend a bit on the context of how you initilize the data.

Regarding the userid for the sign in block. The beta version has a number of critical omissons, including the lack of the userid in the sign in block. Some omissions are intentional, some pending, some oversights. It is hard to tell which is which.

You can hack thunkable a little bit to get the row/column sign in block into a drag and drop project by following these steps:

  1. Create a screen in a column/row (aka non-beta) project
  2. Add the sign in block to the screen
  3. save the screen to My Screens
  4. add the saved screen into a drag and drop project.
  5. Copy the sign in block from the column/row screen into a drag and drop screen.

Presto! An unsupported (potentially crippling in the future) work around.

Athough you can easily overlay components in the beta version and the block screen is much improved, unless I have a specific NEED for the drag and drop, I’m staying with the row/column layout.

Thanks for that. Could you let me know how I can get to the userid which you have shown above? You added a block in the list with “stored variable userID”. I looked up the variables but I do not know how I can create such a userID. Could you explain me how you got that one?


I edited my post above to try to be a little clearer