Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用unity 3d获取google访问令牌?_C#_Unity3d_Access Token - Fatal编程技术网

C# 如何使用unity 3d获取google访问令牌?

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) {

hay我使用unity 3d登录google+我做得很正确现在我想获得访问令牌以使用gamesparks登录,但访问令牌始终为空我不知道为什么,下面是我的代码:

 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())