GodotFirebase
GodotFirebase copied to clipboard
[BUG] Outdated example in docs
Describe the bug Authentication and user management docs are outdated:
func _on_FirebaseAuth_login_succeeded(auth):
var user = await Firebase.Auth.get_user_data()
print(user)
this should instead set a connection in ready and print this in the signal
On this page toward the bottom:
https://github.com/GodotNuts/GodotFirebase/wiki/Authentication-and-User-Management#get-user-data
No - what's there is completely valid. By calling await, it will wait for get_user_data() to return and hand the user back to you, or it should. If that doesn't work, then that's a different bug, so closing this.
Take a look at:
_on_FirebaseAuth_request_completed https://github.com/GodotNuts/GodotFirebase/blob/a0c55125c3643c53c7888ded7103352f36e23318/addons/godot-firebase/auth/auth.gd#L418
you can see it only emits the signal with the data, the function itself returns void.
I just tested implementing the example, and found it didn't work - using the signal method does work.
Okay, like I said then, that's a different bug. I think we were supposed to reimplement it when we switched to 4.0 and I didn't realize that and just went with it. I'll see if I can fix that. If you want to update the title of this, I'll reopen it and will eventually be able to take a look.
I have updated the documentation accordingly. Good find!