Authentication
Firebase Authentication provides backend services, easy-to-use functions, and ready-made UI libraries to authenticate users to your game. It supports authentication using passwords, popular federated identity providers like Google, Facebook and Twitter, and more.
Firebase Authentication integrates tightly with other Firebase services, and it leverages industry standards like OAuth 2.0 and OpenID Connect, so it can be easily integrated with your custom backend.
Firebase Authentication is compatible with other ’s plugin Extended Facebook Online Subsystem.
To sign a user into your app, you first get authentication credentials from the user. These credentials can be the user’s email address and password, or an OAuth token from a federated identity provider. Then, you pass these credentials to the Firebase Authentication SDK. Google’s backend services will then verify those credentials and return a response to the client.
After a successful sign in, you can access the user’s basic profile information, and you can control the user’s access to data stored in other Firebase products. You can also use the provided authentication token to verify the identity of users in your own backend services.
Create User
Create User With Email And Password
Create a form that allows new users to register with your app using their email address and a password. When a user completes the form, validate the email address and password provided by the user, then pass them to the Firebase Create User With Email And Password function.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki23.png
Send Email Verification
You can send an address verification email to a user with the Firebase Send Email Verification function. You can customize the email template that is used in Authentication section of the Firebase console.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki25.png
Send Password Reset Email
You can send a password reset email to a user with the Firebase Send Password Reset Email method. You can customize the email template that is used in Authentication section of the Firebase console.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki26.png
Link with external providers
Link With Credential
You can allow users to sign in to your game using multiple authentication providers by linking auth provider credentials to an existing user account. Users are identifiable by the same Firebase user ID regardless of the authentication provider they used to sign in. For example, a user who signed in with a password can link a Google account and sign in with either method in the future. Or, an anonymous user can link a Facebook account and then, later, sign in with Facebook to continue using your game.
Currently supported providers:
- Email/Password (standard)
- GitHub
You can link provider with an existing user account by initializing appropriate Firebase Credential and calling Firebase Link With Credential. Tokens for Credentials you should obtain on your own (for example for Facebook using Extended Facebook Online Subsystem).
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki32.png
If the call to Firebase Link With Credential succeeds, the user can now sign in using any linked authentication provider and access the same Firebase data.
Unlink Provider
You can unlink an auth provider from an account, so that the user can no longer sign in with that provider. To unlink an auth provider from a user account, pass the provider ID to the Firebase Unlink Provider function.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki33.png
Fetch Providers for Email
Firebase Fetch Providers for Email asynchronously requests the IDPs (identity providers) that can be used for the given email address. Useful for an “identifier-first” login flow.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki34.png
Sign In
Create a form that allows existing users to sign in using their email address and password. When a user completes the form, call the chosen signed in function.
Sign In With Email And Password
The steps for signing in a user with a password are similar to the steps for creating a new account. When a user signs in to your game, pass the user’s email address and password to Firebase Sign In With Email And Password.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki24.png
Sign In Anonymously
You can use Firebase Authentication to create and use temporary anonymous accounts to authenticate with Firebase. These temporary anonymous accounts can be used to allow users who haven’t yet signed up to your game to work with data protected by security rules. If an anonymous user decides to sign up to your game, you can link their sign-in credentials to the anonymous account so that they can continue to work with their protected data in future sessions.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki30.png
Sign In With Credential
After a user signs in for the first time, a new user account is created and linked to the credentials - that is, the user name and password, or auth provider information - the user signed in with. This new account is stored as part of your Firebase project, and can be used to identify a user across every game in your project, regardless of how the user signs in.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki31.png
Sign In With Custom Token
You can use your custom Auth Token authentication. An error is returned, if the token is invalid, expired or otherwise not accepted by the server.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki35.png
Get User Token
The Java Web Token (JWT) that can be used to identify the user to the backend.
If a current ID token is still believed to be valid (i.e. it has not yet expired), that token will be returned immediately. You may set the optional force_refresh flag to get a new ID token, whether or not the existing token has expired. For example, a you may use this when they have discovered that the token is invalid for some other reason.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki36.png
Managing Users
Is User Logged In
You can check if user is logged in to your game calling Firebase Is User Logged In.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki37.png
Get Logged User
To get currently logged user’s profile information, call Firebase Get Logged User.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki38.png
Sign Out
To sign out a user from game, call Firebase Sign Out function.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki39.png
Reauthenticate User
Some security-sensitive actions—such as deleting an account, setting a primary email address, and changing a password—require that the user has recently signed in. If you perform one of these actions, and the user signed in too long ago, the action fails.
When this happens, re-authenticate the user by getting new sign-in credentials from the user and passing the credentials to Firebase Reauthenticate User.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki40.png
Reload User
Firebase Reload User refreshes all the data for currently logged in user.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki41.png
Delete User
You can delete a user account with the Firebase Delete User method. You can also delete users from the Authentication section of the Firebase console, on the Users page. To delete a user, the user must have signed in recently.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki42.png
Update User Profile
Update Email
You can set a user’s email address with the Firebase Update Email function. To delete a user, the user must have signed in recently.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki27.png
Update Password
You can set a user’s password with the Firebase Update Password function. To delete a user, the user must have signed in recently.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki28.png
Update User Profile
You can update a user’s basic profile information - the user’s display name and profile photo URL - with the Firebase Update User Profile function.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki29.png
Authentication Listener
To respond to sign-in and sign-out events, attach the UltimateMobileKit component to the global actor (for example Game Mode). This listener gets called whenever the user’s sign-in state changes. Because the listener runs only after the authentication object is fully initialized and after any network calls have completed, it is the best place to get information about the signed-in user. By using a listener, you ensure that the Auth object isn’t in an intermediate state — such as initialization — when you get the current user.
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki70.png
https://gamednastudio.com/plugins/images/UltimateMobileKit/Wiki71.png