Я пытаюсь войти в firebase с токеном авторизации facebook, полученным из Facebook SDK для единства. Ниже приведен код входа для firebase и facebook.
private void AuthCallback(IResult result)
{
if (result.Error == null)
{
if (FB.IsLoggedIn)
{
Debug.Log("Logged in");
var credential = EmailAuthProvider.GetCredential("email@gmail.com", "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.
Благодарим вас за помощь в решении этой проблемы.