A.Q*_*oga 6 unity-game-engine firebase firebase-authentication
在Firebase unity3D SDK中当我尝试获取凭据时,它会向我询问id_token和access_token.
对于我见过的一些例子,我猜想access_token必须为null,但我不知道如何处理这个id_token.代码示例:
这是电话:
Firebase.Auth.GoogleAuthProvider.GetCredential(string id_token,string access_token);
Run Code Online (Sandbox Code Playgroud)
这是一个unity3D示例代码:
public void GoogleLogin(Action<bool> loginOK)
{
string id_token = "90096201****-353hvgf63fecvvc3mi****s6140f98a.apps.googleusercontent.com";
Firebase.Auth.Credential credential;
credential = Firebase.Auth.GoogleAuthProvider.GetCredential(id_token,null);
auth.SignInWithCredentialAsync(credential).ContinueWith (task =>
{
if (!task.IsCanceled && !task.IsFaulted)
{
loginOK(true);
}
else
{
loginOK(false);
}
if (task.Exception != null)
{
Debug.LogException(task.Exception);
}
});
}
Run Code Online (Sandbox Code Playgroud)
我认为这将是来自谷歌控制台的Oauth 2.0令牌.但这似乎不起作用.谷歌回答告诉我下一个:
11-29 13:58:25.476 com.google.android.gms 2009 3225 I AuthChimeraService
"message":" 无法解析Google id_token:90096201**** - 353hvgf63fecvvc3mi****s6140f98a.apps.googleusercontent.com"
我知道我做错了什么?
google 登录的 firebase 示例应该可以帮助您解决此问题。第一步提到:
firebase 文档还有一个用于手动验证 id 令牌的小节,但他们对此提出了建议。
| 归档时间: |
|
| 查看次数: |
2244 次 |
| 最近记录: |