gpt4 book ai didi

c# - 如何使用 unity 3d 获取谷歌访问 token ?

转载 作者:太空宇宙 更新时间:2023-11-03 15:06:00 24 4
gpt4 key购买 nike

干草我使用 unity 3d 登录 google+ 我现在做对了我想获得访问 token 以使用 gamesparks 登录但访问 token 始终为 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() 始终为空任何帮助请谢谢。

最佳答案

在某些版本的 GPGS 插件中检索访问 token 似乎存在问题。您应该能够通过使用服务器访问代码而不是访问 token 来解决此问题。尝试更换

.SetAccessToken(PlayGamesPlatform.Instance.GetIdToken())

.SetCode(PlayGamesPlatform.Instance.GetServerAuthCode())

关于c# - 如何使用 unity 3d 获取谷歌访问 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43516836/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com