[英]how to get google access token using unity 3d?
hay im使用unity 3d登录google +我现在正确地做到了,我想获取访问令牌以使用gamesparks登录,但是访问令牌始终为null我不知道为什么,这是我的代码:
public void GoogleSignIn()
{
if (!signedin)
{
Social.localUser.Authenticate((bool success) =>
{
if (success)
{
Debug.Log("yes");
}
else
Debug.Log("no");
});
}
}
public void GooglePlaySignInWithGS()
{
new GameSparks.Api.Requests.GooglePlusConnectRequest()
.SetAccessToken(PlayGamesPlatform.Instance.GetIdToken())
.SetDoNotLinkToCurrentPlayer(false)
.SetSwitchIfPossible(true)
.Send((Google_response) =>
{
if (!Google_response.HasErrors)
{
OnAuthentication(Google_response);
Debug.Log("done");
}
else
{
Debug.LogWarning(Google_response.Errors.JSON);
}
});
}
getIdToken()始终为null,请帮助。谢谢。
在某些版本的GPGS插件中检索访问令牌似乎存在问题。 您应该能够通过使用服务器访问代码而不是访问令牌来解决此问题。 尝试更换
.SetAccessToken(PlayGamesPlatform.Instance.GetIdToken())
同
.SetCode(PlayGamesPlatform.Instance.GetServerAuthCode())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.