A non-official Firebase RESTful Authentication Client for the Unity Game Engine.
Based on FirebaseAuthentication.net
All copyrights, trademarks, logos, and assets are the property of their respective owners.
- Open your Unity project settings
- Add the OpenUPM package registry:
Name: OpenUPM
URL: https://package.openupm.com
Scope(s):
com.rest.firebase
com.utilities
- Open the Unity Package Manager window
- Change the Registry from Unity to
My Registries
- Add the
Firebase.Authentication
package
- Open your Unity Package Manager
- Add package from git url:
https://github.com/RageAgainstThePixel/com.rest.firebase.authentication.git#upm
Note: this repo has dependencies on other repositories! You are responsible for adding these on your own.
By default the FirebaseAuthenticationClient
will attempt to load the FirebaseConfigurationSettings.asset
scriptable object asset if one exists.
If no FirebaseConfigurationSettings.asset
can be found then the client will attempt to load te google-services.json
file in the local project folder.
Last, it will attempt to load the environment variable FIREBASE_CONFIGURATION
which should point to a google-services.json
path.
Alternatively, you can also explicitly specify an api key and auth domain when creating the client:
var firebaseClient = new FirebaseAuthenticationClient("apiKey", "hello.firebase.com");
FirebaseUser firebaseUser;
try
{
firebaseUser = await firebaseClient.SignInWithEmailAndPasswordAsync("username", "password");
}
catch (Exception e)
{
Debug.LogError(e);
return;
}
Debug.Log($"Signed in as {firebaseUser.Info.DisplayName}");
firebaseClient.SignOut();