GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
532 stars 76 forks source link

add anonymous + google oauth login #64

Closed fenix-hub closed 3 years ago

fenix-hub commented 3 years ago

Related to #63

Added two new requests support on endpoints:

Sign In Anonymously

It is now possible to let users sign in anonymously without using any information.
To let users login anonymously to your application, enable "Anonymous" in "Authentication > Sign-in method" inside your project.
To request an anonymous login, call the provided function:

Firebase.Auth.login_anonymous()

if the request returns correctly without any error, the login_succeeded signal will be called with the response body.
Inside the response body there will be a localid key representing the UUID associated by Firebase to this anonymous user.
You will find it inside users list: TScaXqnFZU

Sign In with OAuth (Google)

Support for #accounts:signInWithIdp has been added.
Direct access to this API will not be possible with a basic plugin setup currently, so in order to request properly this endpoint an additional configuration will be required.
To issue an oauth login request this function must be called:

Firebase.Auth.login_with_oauth(oath_token)

where oauth_token is a token manually passed by the user to the application. It can be obtained calling this function:

Firebase.Auth.get_google_auth()

and saving the result prompted to the user in the web browser inside a LineEdit or any editable text Control node.
Example on how to use it has been added to the wiki Once a user has logged with Google OAuth, it will be listed like this: PEk4UXA37E