Firebase Facebook身份验证在Unity中失败

问题描述 投票:0回答:1

我正在尝试使用从Facebook SDK获得的Facebook身份验证令牌登录到Firebase以获得统一。以下是Firebase和Facebook的登录代码。

    private void AuthCallback(IResult result)
    {
        if (result.Error == null)
        {
            if (FB.IsLoggedIn)
            {
                Debug.Log("Logged in");
                var credential = EmailAuthProvider.GetCredential("[email protected]", "password");
//                var accessToken = AccessToken.CurrentAccessToken.TokenString;
//                var credential = FacebookAuthProvider.GetCredential(accessToken);
                auth.SignInWithCredentialAsync(credential).ContinueWith(task =>
                {
                    if (task.IsCanceled)
                    {
                        Debug.LogError("SignInWithCredentialAsync was canceled.");
                        return;
                    }

                    if (task.IsFaulted)
                    {
                        Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
                        return;
                    }

                    FirebaseUser newUser = task.Result;
                    Debug.LogFormat("User signed in successfully: {0} ({1})",
                        newUser.DisplayName, newUser.UserId);
                });
            }
            else
            {
                Debug.Log("Not Logged in");
            }
        }
        else
        {
            Debug.Log(result.Error);
        }
    }

    public void FbLogin()
    {
        var permissions = new List<string> {"public_profile", "email"};
        FB.LogInWithReadPermissions(permissions, AuthCallback);
    }

我收到以下错误。

SignInWithCredentialAsync encountered an error: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: The supplied auth credential is malformed or has expired.
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: The supplied auth credential is malformed or has expired.
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: The supplied auth credential is malformed or has expired.<---
<---

此错误仅在FacebookAuthProvider时发生。 EmailAuthProvider可以正常使用。我使用了Graph API Explorer来获取facebook的身份验证令牌。

感谢任何帮助来解决此问题。

firebase unity3d facebook-unity-sdk
1个回答
0
投票

对此有任何更新吗?我也有完全相同的问题。 TIA

© www.soinside.com 2019 - 2024. All rights reserved.