How to get data from my RealTimeDatabase ? #429
-
Hello, Important note : I'm using Godot 4, so I got the code from the 4.x branch which seems to works fine. Don't know if it could be an issue for me.
I followed the https://github.com/GodotNuts/GodotFirebase/wiki/Realtime-Database#connecting-signals examples, and after some struggles I was able to make it partially works : Bonus question : I first tried to login anonymously, and even after I activated that on my firebase project, it never seemed to reach _on_FirebaseAuth_login_succeeded. I wasn't getting on_login_failed anymore, but no succeed either. Logging with an email does work fine though. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I'm not sure why anonymous login wouldn't work. But there's an obvious problem why the realtime database isn't working: you are calling to the reference immediately. It needs to wait a little bit to make the connection the first time. There's also a much better way to connect to the signal. Here, try this:
Everything else can stay the same I believe. If that doesn't work, my only real guess based on the info you've provided is something must be wrong with the configuration, probably the rules. Regarding anonymous login, I suspect that's the case as well. Our tester program runs all of these just fine. https://github.com/GodotNuts/GodotFirebaseTestHarness/ |
Beta Was this translation helpful? Give feedback.
-
Hello @WolfgangSenff, thanks for the quick feedback. I tried the code you sent and got the exact same result :
My rules for the database couldn't be simplier :
So the db_ref looks fine, the login looks fine (at least the succeded signal was sent and caught), the rules looks fine. |
Beta Was this translation helpful? Give feedback.
-
Hm, I'm not sure. I'd probably have to see more of your setup. Is it possible to PM me the project (without the .env file) on Discord? I saw you just joined. I'm happy to take a look that way. |
Beta Was this translation helpful? Give feedback.
-
@WolfgangSenff , nevermind I'm stupid. I was playing with the addons files to understand and debug, like returning error code for some requests and so on and I messed up something. Once I reverted my local changes, it works fine properly. The solution for my case, which I'll mark as solution, was to not mess up the addons file, they work perfectly as is 👍 Side note : Once that was working, I tested again the anonymous login, and that still doesn't work. I'm not hitting the _on_FirebaseAuth_login_succeeded. |
Beta Was this translation helpful? Give feedback.
@WolfgangSenff , nevermind I'm stupid. I was playing with the addons files to understand and debug, like returning error code for some requests and so on and I messed up something. Once I reverted my local changes, it works fine properly.
The solution for my case, which I'll mark as solution, was to not mess up the addons file, they work perfectly as is 👍
Side note : Once that was working, I tested again the anonymous login, and that still doesn't work. I'm not hitting the _on_FirebaseAuth_login_succeeded.
On firebase the anonymous user is properly created though.
Maybe that's because I should listen to the register signal instead?