What on earth am I doing wrong?

I created this code a few days back. It achieved the desired result of saving information onto my firebase server.
But now the exact same code (which I have not changed) is suddenly not saving information to the server anymore.

Am I missing something? I seem unable to attach a screenshot so here is an explanation.

I have user click a button and when they do it sets a cloud variable called “join”-text:“/userRegMatch/” & component:“ti_authorisedViewer’s text” to “list: app variable targetReg”.

It has definitely worked. And I have definitely changed nothing

How old is your Firebase database? After 30 days, it converts and the rules cannot allow open access to your data.

Check your Firebase rules in your Firebase console.

It is older than 30 days. But I have just checked and both read and write are set to true.

I’ve been doing a little troubleshooting: if I call the cloud variable simply “userRegMatch” and set it to component “ti_authorisedViewer” then it does save this. It even saves it in a list if I ask it to. But it will not allow me to use the join text component to create a subfolder called “ti_authorisedViewer”.

What I want is to be able to create a folder called “userRegMatch” with a child folder underneath titled whatever is put into component “ti_authorisedViewer”. Then “ti_authorisedViewer” becomes the parent folder to a list of registration numbers.

I should mention that there is another variable where I am trying the exact same thing with another folder path and it works fine.

It sounds like there might be a typo or unexpected variable value that is causing this then. Can you post a screenshot of the blocks that work to join a path and a screenshot of the blocks that do not work to join a path?

I can do. However, I have done a little more troubleshooting: I tried setting a local app variable called “testReg” to the text input component and then displaying a label with text from that variable. It was returning the word “Label” as though I had not entered anything into the text input when of course I had.

The screenshots as requested. The top cloud variable works fine. Bottom one does not

I am leaning heavily toward the fact that something is going wrong between getting test from text input and inserting it into server. Although the top variable gets the correct text so I don’t know.

Ok done a little more fiddling and it seems something is happening with the @ symbol. Can I not use @ symbols in a folder path maybe?

Ok after a lot of digging and searching around I can confirm that Thunkable (or possibly the firebase database) does not like the @ symbol to be used. My limited understanding of technology tells me that this symbol means something that I do not intend it to mean and so the system treats it differently. Whatever the case, when I have removed the @ symbol and used UID instead the variable is acting how I want it to. Now I need to find a way to get the UID of whatever email address is entered into the text input.

1 Like

Ok I have figured out a way round all of this.
I think it’s firebase that doesn’t like the @ symbol. In my text input I was identifying authorised viewers by their email address which obviously contains an @ symbol. This can be used in the “value” of the item on the server but not in the “key”.
I think to get UID associated to an email address I would have to implement some long complicated function which is beyond my capabilities and understanding but also I presume opens up more possibilities for security exploitation.

So my fix was to demand from sign up that users choose a username. Their account can not be created without one. This username is then assigned to their account so whenever they sign in the username is saved into a local variable. If this local variable matches the folder path I have been trying to implement since the beginning then they will be able to see the items I want them to see. But only the items that are registered to that account. Now I need to find a way they can’t just type in a random username after sign up and see someone elses details. But that feels like an easier task than the one I have just had.

The Sign-In block has a green userId block that is what I use to create unique Firebase paths. See Email Sign In by Firebase - Thunkable Docs.

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