Hello everyone, I'm experimenting with Google Firebase Authentication in Unity. I imported the SDK and I've been trying to actually get the authentication to get running for a few days but I'm not sure what to do. I'd like to stay away from Google *Play* Services and use the regular business looking authentication screen.
Upon pressing the login button for google this is called,
public static void Login_Google(Action Callback)
{
Log.Create(0, "Login to google event", "Authentication");
string access_token = "";
FirebaseAuth firebaseAuth = FirebaseAuth.DefaultInstance;
// Login to google and return the key to call the authenticate method
Credential credential = GoogleAuthProvider.GetCredential(id, access_token);
firebaseAuth.SignInWithCredentialAsync(credential).ContinueWith(task =>
{
if (task.IsCompleted && !task.IsCanceled && !task.IsFaulted)
{
// User is now signed in.
Firebase.Auth.FirebaseUser newUser = task.Result;
Callback();
}
});
}
The Callback() will return to this,
private void CallbackGoogle()
{
Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
Firebase.Auth.FirebaseUser user = auth.CurrentUser;
if (user != null)
{
string name = user.DisplayName;
string email = user.Email;
string picture = user.PhotoUrl.AbsolutePath;
// The user's ID, unique to the Firebase project.
// Do NOT use this value to authenticate with your backend server,
// if you have one. Use User.Token() instead.
string uid = user.UserId;
string refreshToken = user.RefreshToken;
Debug.Log("name: " + name + ", email: " + email + ", picture: " + picture + ", uid: " + uid + ", refreshToken: " + refreshToken);
}
}
Here's the issue.
I open the app, my log, "Logging into Google Event" is called and I see it in logcat but after that my app crashes and returns to my main menu with the message, "App has stopped working". No error in logcat.
I go back to the docs and notice a little piece that says, "Follow instructions for Android and iOS to get an ID token for the Google sign in."
TLDR; Does anyone know how or if its even possible to add a regular google sign in to unity, (Not the play services login). And is there a package I can download for *UNITY* Google Sign in options?
This isn't extremely urgent but I would like a response on this. Currently facebook is the only authentication service in my app and I'd like to add Google as well. If this isn't possible at the moment someone please tell me so I can begin developing an email/pass authentication service.