【问题标题】:Google Play Games Service : ERROR_NOT_AUTHORIZED, when rollout for BetaGoogle Play 游戏服务:推出 Beta 版时出现错误 NOT_AUTHORIZED
【发布时间】:2019-09-30 21:29:34
【问题描述】:

Google Play 游戏服务:SIGN_IN 状态:ERROR_NOT_AUTHORIZED,推出测试版时。 还有这个:-

W Auth    : [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
E TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE

如果我直接从 Unity 构建和运行,一切正常。 但是当我推出 Beta 版时,它会显示带有加载圆圈的 Sign In Google 绿色框(然后是帐户 -> 选择 beta 测试者电子邮件),然后什么也没有。

使用:-

  • GooglePlayGamesPlugin-0.9.38a
  • 统一 5.6.03
  • sdk 组件更新 rev 40 , rev 51

我做过的事情:-

  1. 创建了一个新的应用程序 google play 控制台
  2. 添加了 apk,进行了测试,然后进行了生产部署。
  3. 后来我在新更新中添加了玩游戏服务,推出了测试版。
  4. 注意 - 所有 apk 、推出使用相同的密钥库和包名称。
  5. Google Play 控制台 -> 发布管理 -> 应用签名:上传 证书 SHA1 与 Google API -> 项目 -> 客户端 ID 相同 Android SHA1

玩游戏设置:-

  • Beta 测试人员电子邮件:打开
  • 游戏保存数据:关闭
  • 测试电子邮件:已添加电子邮件
  • Alpha 和 Beta 测试:都打勾(绿色)

以下日志:

05-23 12:55:44.400 28917 29002 I GamesNativeSDK: Auth operation started: SIGN IN

05-23 12:55:44.400 28917 29002 I GamesNativeSDK: Connecting to Google Play...

05-23 12:55:44.522 28917 28948 W Unity : !!! [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 WARNING: Creating new PlayGamesPlatform

05-23 12:55:44.522 28917 28948 W Unity :

05-23 12:55:44.522 28917 28948 W Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

05-23 12:55:44.522 28917 28948 W Unity :

05-23 12:55:44.522 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: Activating PlayGamesPlatform.

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: Creating platform-specific Play Games client.

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: Creating Android IPlayGamesClient Client

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: Invoking callbacks, AuthState changed from silentPending to Unauthenticated.

05-23 12:55:44.523 28917 28948 I Unity : [Play Games Plugin DLL] 05/23/17 12:55:44 +05:30 DEBUG: there are pending auth callbacks - starting AuthUI

C# 代码:

     using UnityEngine;
     using GooglePlayGames;
     using GooglePlayGames.BasicApi;
     using UnityEngine.SocialPlatforms;

     public class PlayGameManger : MonoBehaviour {

         public static PlayGameManger Instance{ set; get;}
         public bool isLogedIn;
         void Awake () {
             if (Instance == null) {
                 Instance = this;
                 isLogedIn = false;
                 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ().Build();
                 PlayGamesPlatform.InitializeInstance (config);
                 PlayGamesPlatform.DebugLogEnabled = true;
                 PlayGamesPlatform.Activate ();
                 SignIn ();
                 DontDestroyOnLoad (gameObject);
             } else {
                 Destroy (gameObject);
             }
         }

         public void SignIn(){
             if (isLogedIn == false) {
                 Social.localUser.Authenticate (success => {
                     isLogedIn = success;
                     //Debug.Log("Signin : "+success);
                 });
             }
         }
 // Achievements and other code here
 }

帮助, 谢谢:)

【问题讨论】:

  • 嗨阿克沙伊。您是否浏览过其中一些帖子:GitHubGitHub 2StackOverflow - 看看他们是否尝试过您还没有尝试过的不同之处?该错误可能是由于某种控制台上的错误配置,因为您提到它在直接从统一运行时可以正常工作。

标签: c# android google-play-services


【解决方案1】:

现在一切正常。 由于启用了 Google App Signing 而无法正常工作,我想我们必须对 AndroidManifest.xml 进行一些更改才能使 Google Play 游戏服务正常工作 见这里:-https://support.google.com/googleplay/android-developer/answer/7384423 但下面给出的解决方案也可以正常工作。

[已解决]

我做了什么:-

  1. Google Play Console -> 选择您的应用 -> 发布管理 -> 应用签名 -> 应用签名证书:复制 SHA-1(不要复制单词 'SHA1:')

  2. 打开 https://console.developers.google.com/ ,选择您的项目 -> 凭据 -> OAuth 2.0 客户端 ID -> 编辑 OAuth 客户端 -> 签名证书指纹 -> 用复制的 SHA1 替换旧的 SHA1 ->保存。

  3. 打开你的游戏,你应该得到登录 -> 电子邮件选择 -> 选择测试人员的电子邮件。 Google Play 游戏服务现在应该可以正常工作了。

【讨论】:

  • 天哪,你救了我整个晚上。我在文档中的任何地方都没有找到这一步,只是假设我的 prod 密钥库中的 SHA1 一直被使用
猜你喜欢
  • 2017-10-24
  • 1970-01-01
  • 2016-02-16
  • 1970-01-01
  • 2021-04-27
  • 1970-01-01
  • 2016-02-04
  • 1970-01-01
  • 2017-06-13
相关资源
最近更新 更多