Google Play Games for Unity 登录用户 returns "GetToken failed with status code: NeedPermission"

Google Play Games for Unity logging in user returns "GetToken failed with status code: NeedPermission"

我正在使用 Unity 的 Google 服务插件,可在此处找到:https://github.com/playgameservices/play-games-plugin-for-unity

我正在尝试添加基于 Google 的身份验证并获取服务器授权码。

像这样初始化插件:

PlayGamesClientConfiguration playGamesConfiguration = new PlayGamesClientConfiguration.Builder()
            .RequestServerAuthCode(false)
            .AddOauthScope("profile")
            .AddOauthScope("email")
            .Build();
PlayGamesPlatform.InitializeInstance(playGamesConfiguration);
PlayGamesPlatform.DebugLogEnabled = Debug.isDebugBuild;
PlayGamesPlatform.Activate();

然后登录用户,调用:

UnityEngine.Social.localUser.Authenticate((success, errorString) => {
// Code here
}

当我 运行 游戏时,我看到 "Connecting to Google Play Games" window 弹出窗口,但应该在登录用户后看到横幅屏幕。但我没有得到横幅。以下是一些相关日志:

2295  2295 D GamesUnitySDK: Performing Android initialization of the GPG SDK
2295  2295 I Unity   : Building GPG services, implicitly attempts silent auth
2295  2694 I GamesNativeSDK: Auth operation started: SIGN IN
2295  2694 I GamesNativeSDK: Connecting to Google Play...
2295  2295 V GamesNativeSDK: Received Activity Resume Event.
1441  1452 W Auth    : [GetToken] GetToken failed with status code: NeedPermission
1383 17763 W Auth    : [GoogleAuthUtil] GoogleAuthUtil
2295  2295 V GamesNativeSDK: Play Games callback indicates connection failure.
2295  2694 I GamesNativeSDK: UI interaction required to connect to Google Play.
2295  2322 I Unity   : Success: False string: Authentication failed

"GetToken failed with status code: NeedPermission" 行似乎是最重要的。我假设插件在内部调用 GetToken 来满足我的请求,但我不知道它需要什么权限,或者用户是否应该提供此权限,或者这是否是仪表板中的开发人员权限。

如有任何帮助,我们将不胜感激。

作为后续结果,Google Play 游戏控制台设置不正确。那里有一些问题,我认为最重要的是测试用户没有获得 API 访问权限。由于我无法访问控制台,因此无法自行验证设置。

作为对 Google 的额外评论,错误代码中提供的信息越多,就越容易找出配置错误的地方。许多项目使用分布式团队,并且可以实际与开发控制台交互的人可能更多是制作人,而不是技术人员。能够准确地告诉他们如何修复错误消息可以节省大量调试时间。