C# 如何使用unity 3d获取google访问令牌?
hay我使用unity 3d登录google+我做得很正确现在我想获得访问令牌以使用gamesparks登录,但访问令牌始终为空我不知道为什么,下面是我的代码:C# 如何使用unity 3d获取google访问令牌?,c#,unity3d,access-token,C#,Unity3d,Access Token,hay我使用unity 3d登录google+我做得很正确现在我想获得访问令牌以使用gamesparks登录,但访问令牌始终为空我不知道为什么,下面是我的代码: public void GoogleSignIn() { if (!signedin) { Social.localUser.Authenticate((bool success) => { if (success) {
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()始终为空
有什么帮助吗
谢谢。在某些版本的GPGS插件中检索访问令牌时似乎出现问题。您应该能够通过使用服务器访问代码而不是访问令牌来解决这个问题。试着替换 .SetAccessToken(PlayGamesPlatform.Instance.GetIdToken()) 与 .SetCode(PlayGamesPlatform.Instance.GetServerAuthCode())