用户登录的Google Play游戏用户返回“GetToken失败,状态代码为:NeedPermission”

问题描述 投票:0回答:1

我正在使用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
}

当我运行游戏时,我会看到弹出“正在连接到Google Play游戏”窗口,但应该登录用户并在屏幕顶​​部看到横幅。但我没有得到任何旗帜。以下是一些相关日志:

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失败,状态代码:NeedPermission”行似乎是最重要的。我假设插件内部调用GetToken以满足我的请求,但我不知道它需要什么权限,或者用户是否应该提供此权限,或者这是否是仪表板中的开发人员权限。

任何帮助,将不胜感激。

android authentication unity3d google-play-services google-play-games
1个回答
0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.