Cloud variable saved but do not load on change and dynamic cloud variable name

Hello all,

I just want to have a simple app that is saving data on my firebase and then retrieve the data in another text field whenever this cloud variable change.
when I am saving the data it is ok on my cloud but when I trigger the initialize or change variable and set the text 2 nothing appends :frowning:

second question :
do you know how to get the block when cloud variableā€¦ init ā€¦ with dynamic cloud variable name.

1 Like

At the moment, dynamic variables cannot have initializes or changes block.

1 Like

Thanks

Do you have any ideas concerning my issue with the cloud variable and why I do not get the value in my text ?

1 Like

The first case works fine.

I just tested it
image

1 Like

Thanks, I will continue my investigation because I do not get whatā€™s wrong :frowning:
thanks for your time

1 Like

hello,

just to let you know that we found with the support an issue with the sign-in and the listener on the same screen.
If we split the sign_in and the cloud listener into 2 screens it is working.

1 Like

Thank you for the update.

I did not understand this point. Can you share a code block to clarify the idea?

1 Like

Hi! I just wanted to share this project here for you all to check out! It demonstrates using these blocks along with firebase authentication!

https://x.thunkable.com/copy/77e2fec511385f9626d8dfd7d76c8aca

while they are not the most secure rules, they do require a user to be authenticated to access any data. if youā€™re not signed in, you canā€™t access the data.

It should be noted that the ā€œwhen cloud variable changes or initializesā€ should not live on the same page that you are logging in through. Although that is typical of a single page app, it currently does not work in Thunkable apps and is not best practice when making an app in Thunakble.

So, log in on page 1, listen for changes to your cloud variable on page 2

2 Likes

Sorry I deleted my comment on the app variable because It is not working in fact sorry :frowning:

1 Like

something that I found is that the setup of the cloud variable in the realtime db and the listener need to be done with the sign in method of thunkable.
but the auth with the sign_in cannot be used for other firebase auth. (I do not see how to get the token)
so if you want to use firestore and realtime db for the project and the ā€œcloudā€ variable function for the listener you will need to use a double auth with sign_in block in order to use the cloud function and the auth with a web api to get the token for the rest. :frowning:

ps: we can use realtime with the web api and the token but then I did not manage to have the main function of RTDB that is the listener for the app :frowning:

if you have any ideas let me know.

1 Like

The perfect solution is for Thunkable to allow the Sign In component to provide the token along with the user ID that is currently provided.

However, if it is OK with you to share your project, I need to go at it and see if possible to use the Listener feature in it.

[Edit]
I just checked and it seems that cloud variables in Thunkable only sees Realtime DB in Firebase and that leaves you with practically no choice for this issue.

1 Like

Hey @alex_ezacae

You are absolutely correct.

At this time the Firebase auth blocks will not allow you to pass around or see the userā€™s access token. In your case, using Firestore or the Firebase functions will require you to manually create the sign-in flow.

You are also correct that if you do use a manual sign in method, you wont be able to use the ā€œwhen cloud variable initializes or changesā€ when you have security rules on your firebase database.

2 Likes

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