简体   繁体   中英

Firebase Unity SDK Auth using Facebook Token

I am using the Firebase SDK for Unity. I am trying to do Firebase auth using Facebook credentials but I am getting the below error on Android. Everything looks configured properly in the Firebase Console. I have enabled Facebook as a Sign-In-Method and added the OAuth redirect URL to my Facebook app configuration. Thank you for any help.

 private void AuthFirebaseFacebook(string token) {
            Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
            Firebase.Auth.Credential credential =
            Firebase.Auth.FacebookAuthProvider.GetCredential(token);
            auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
                if (task.IsCanceled)
                {
                    AtagDebug.Log("SignInWithCredentialAsync was canceled.");
                    return;
                }
                if (task.IsFaulted)
                {
                    AtagDebug.Log("SignInWithCredentialAsync encountered an error: " + task.Exception);
                    return;
                }

                Firebase.Auth.FirebaseUser newUser = task.Result;
                AtagDebug.Log("User signed in successfully: " +
                    newUser.DisplayName + " " + newUser.UserId);
            });
        }


SignInWithCredentialAsync encountered an error: 
System.AggregateException: Exception of type 'System.AggregateException' was thrown. 
Firebase.FirebaseException: An internal error has occurred. [ Access Not Configured. Google Identity Toolkit API has not been used in project 98824003602 before or it is disabled. Enable it by visiting https ]

The problem was I had an outdated google-services.json in one of my Android Plugins. Note to self and others: Be sure to update the google-services.json not only in Unity, but any plugins or external code you are using that gets built into the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM