Saving data in firebase issue

So im making a chat app. I had this idea how to make one with lists. It aint gonna look pretty but I want to give it a go :slight_smile:

So im setting up sign in and sign up and thats fine, but i want users to have profile info, so i am using their email as a profile tag and then joining words to the end like FIRST NAME and LAST NAME and BIO etc etc. This means when another user requests info about them they can see all this on a profile screen. This works great when gathering info from firebase as i have done this before in a different project but when trying to join the two words together they do not save in firebase: the auth works fine i can see emails show up so it can’t be wrong link or key.

The tag i am uploading is as follows:

{useremailhere} FIRST NAME
{useremailhere} LAST NAME

but they do not upload. anyone know of any such causes? all help is appreciated.

thanks

(edit)
I will change this to username for security reasons of course, but you get the idea :slight_smile:

I’m working on one just like it for a dispatch app. You’re making the key the users email and trying to save the first name as value and last name as another value correct?

@eoinparkinson I don’t really understand what the problem is -> Pictures of your blocks that save to firebase and what you are getting in firebase would be helpful.

kind of correct yes. Just realised firebase cant have special characters as the tag, so yeah

yes, sorry here are some photos.

So as you can see the variables kind of tell you what everything is.

The signup screen gets first name, last name, a chosen username, your email and a password. from there is goes through google authentication in firebase. once that is successful (check for email used before) it tries to make a value as follows: {username} FIRST NAME and another called {username} LAST NAME

Then when somebody looks at their profile, it gets their username and from there can join the words to get the data it needs to display on the profile page. that was the idea anyway.

I would bet 5 dollars its because you are using spaces in the key. Try using username_first_name as the key (underscores instead of spaces).

Personally, I would save each users information as objects under there username:

1 Like

So the variables do not seem to work very well with firebase now. if you look at the docs it shows using the new object blocks. I made the key the users First and Last name without a space (FIRSTLAST) and made them uppercase as it is easier to match then I made the value the users unique Firebase ID. After a user entered in their profile info I saved all that info under their FirebaseID.

https://docs.thunkable.com/realtime-db

1 Like

thanks that works great. So how would i go about retrieving that data now, to show on a profile screen.

thanks again

Great! And see the bottom half of my screenshot above for reading the data from an object.

Also I have a video series on working with firebase here --> https://www.youtube.com/watch?v=RgS1yNWQTag&list=PLArgGKS_QtY7cnVCS5-uRm-fRpC96rMUn&index=5&t=6s

fantastic stuff!!

thank you both for the help really appreciate it.

I shall continue on :slight_smile:

3 Likes

I would urge folks to use cloud variables (doc here) rather than the Realtime DB component. In most situations it is much easier to use.

-Mark

1 Like

@Mark Thanks for your input! I see yall took away the big warning advising people to use the realtime db when publishing the app instead of cloud variables that used to be in the docs. Has thunkable updated the retention policies related to data stored in cloud variables? Can we trust thunkable wont clean out the cloud database removing our apps data?

Also I’m curious if an app with cloud variables “blows up” and starts getting a lot of traffic that would regularly move it out of the free firebase plan, is Thunkable then going to pay the firebase bills?

Darren,

Cloud variables use Firebase under the covers, in a similar way to the Realtime DB. As with that component you should create and use your own Firebase account to deal with any privacy, visibility or data retention concerns that you might have. Info on how to set that up and connect it your Thunkable project can be seen in our docs, here.

Hope this helps!

-Mark

1 Like