Typically I wouldn’t use Firebase as a Database, mostly because the connection between Thunkable and Firebase is used only for authentication. Instead, use Google Sheets as an alternative to have the ability to access and change the spread.
Let me explain further into detail what you can do (scroll down if you want to skip this):
Whenever the Google account is recorded onto the app with the get profile from Google block, you can add a new row containing whatever info you need later on in your app. The Google account will actually stay signed in even if you close the app until you call a command that signs out your Google account. You can set variables for the blocks like User ID, Display name, Profile photo image URL and others too.
Whenever the “Sign in with Google” block is clicked, you can append a new row with all your variables. The next time someone signs in with the same account, grab a block that can search through your data and look if the account has been created already or not.
when google Click:
set stored variable auth method to "Google"
get profile from Google:
if inputEmail ≠ list of values in (spreadsheet) in Sheet1 in Default View in (specific column):
create row in (spreadsheet):
"Insert variables into placeholders"
call Alert1 Show:
with output - was confirmed
set Alert1 message to "Welcome!"
then do:
navigate to Form1
else:
call Alert1 Show:
with output - was confirmed
set Alert1 message to "Welcome back!"
then do:
navigate to Form1
"Then continue your code below"
If you need any more help, let me know or contact Thunkable Staff and more reliable help.
I wanted to use firebase for speed and real time sync.
Thanks for your idea of google sheets btw!
But I think firebase is more faster for real time data and sync.
I asked @tatiang about the reliability between Firebase and Google Sheets. While Firebase has better security, Google Sheets has more ease of usage. And while you are correct for real time data sync, Google Sheets updates every second. As long as your Google Account is connected with Thunkable and your Drive is accessible, it should work the same. Firebase gives a more complex but thorough state in the Realtime Database, while Google Sheets is just for storing a little bit of data.
Try this out and see how it goes; please do not delete your original code. Keep it unattached from a when block and insert your new code that I have provided. Good luck!
It is not my opinion to choose your chosen database. Google Sheets and Firebase can do the same things. I’m not specialized in using a proper database through Firebase. You may want to contact the support team for more help, unless I find a better solution.
For sure! I’m sorry that I can’t help much, but I sincerely hope someone actually does help. Good luck on completing this! I will continue to look for an answer ASAP.
My reason for using Google Sheets is to insert it into a Data List/Grid viewer. That’s also one of the main reasons why I actually don’t use Firebase. Maybe soon it can change. I will put it as a feature request (check my profile later on this week)
You can paste that JSON text into Best JSON Viewer and JSON Beautifier Online on the left side and then on the right side click on a property such as “email” to see the path to that property. You can use get property of object blocks in Thunkable to extract the values you need.
If you’re trying to loop through multiple entries like that, it’s best to paste the full JSON response as text (not a screenshot) in a post here. Make sure to format the text using the </> in the forum toolbar above your post. That will remove smart quotes that prevent the code beautifier site from reading the JSON.