GodotFirebase icon indicating copy to clipboard operation
GodotFirebase copied to clipboard

[BUG] Outdated example in docs

Open phil-hudson opened this issue 1 year ago • 3 comments

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

phil-hudson avatar Jun 21 '23 06:06 phil-hudson

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.

WolfgangSenff avatar Jun 21 '23 06:06 WolfgangSenff

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.

phil-hudson avatar Jun 21 '23 06:06 phil-hudson

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.

WolfgangSenff avatar Jun 21 '23 14:06 WolfgangSenff

I have updated the documentation accordingly. Good find!

WolfgangSenff avatar May 27 '24 11:05 WolfgangSenff