So, I tried making a Google Sign In Option on my Unity Apps by mixing it with Firebase. So, i import the google signin plugin v1.04 and write the code. While building it to *.apk file nothing error show up on the console. But, when i try to login it force close after i chose which account i'm gonna use to login. Here's my full code:
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Google;
using UnityEngine;
using Firebase.Auth;
public class googleAuth : MonoBehaviour
{
[SerializeField] string webClientID = "190747548795-haa9ej8fkg584c1r5nkhu7u6ol50tmcf.apps.googleusercontent.com";
GoogleSignInConfiguration configuration;
private void Awake() {
configuration = new GoogleSignInConfiguration{
WebClientId = webClientID,
RequestIdToken = true
};
}
public void loginGoogle(){
GoogleSignIn.Configuration = configuration;
GoogleSignIn.Configuration.UseGameSignIn = false;
GoogleSignIn.Configuration.RequestIdToken = true;
GoogleSignIn.DefaultInstance.SignIn().ContinueWith(OnAuthenticationFinished);
}
void OnAuthenticationFinished(Task<GoogleSignInUser> task){
if(task.IsCanceled)
print("error");
if(task.IsFaulted)
print("error");
if(task.IsCompleted){
googleFirebase(task.Result.IdToken);
}
}
void googleFirebase(string token){
Credential credential = Firebase.Auth.GoogleAuthProvider.GetCredential(token,null);
FirebaseAuth.DefaultInstance.SignInWithCredentialAsync(credential);
}
}
It means you are missing files in the Plugins/Android/ folder.