Google Play游戏服务 - 登录失败(OAUTH2:UNREGISTERED_ON_API_CONSOLE)

时间:2017-02-18 11:57:35

标签: android google-api oauth-2.0 sha1 google-play-games

目前我正在尝试将Google Play游戏服务登录到我的Android应用程序。到目前为止,我已经遇到了很多麻烦,但似乎我正在接近实际工作。

问题: 当我按登录时,登录功能会返回以下错误:

02-18 12:31:51.122 5524-21263/? W/Auth: [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE
02-18 12:31:51.128 5206-5723/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE
02-18 12:31:51.144 5206-32272/? W/GamesServiceBroker: Client connected with SDK 8487000, Services 10298230, and Games 39080030

到目前为止我做了什么:

我试图尽可能地遵循文档,但要么我做错了,要么就是一团糟。我猜错了。

我的清单文件包含以下内容:

<meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

我有一个games-ids.xml文件,其中包含App-ID和ID,用于获得高分和成就。

我的傻瓜:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.duke.privatpc.quiztest"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':BaseGameUtils')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
}

这包括从“入门页面”下载的BaseGameUtils。

我在Google Play开发者控制台设置了游戏并添加了创建的App-ID。

我总是使用自己的密钥库来创建apk以及创建App-ID。是否需要在任何时候使用debug.keystore?

正如您在此处所见,SHA1是相同的,并显示正确的APP-ID。

  1. APK SHA1
  2. Developer Console SHA1
  3. 老实说,我不知道我做错了什么。我也激活了测试并输入了我的电子邮件地址。

    此外,单击我的登录按钮时绝对没有任何反应。没有Google Overlay弹出,我不确定这是否已经很奇怪了?

    我希望有人可以帮助我,因为我没有找到任何可以帮助我的问题,对于像我这样的业余程序员来说,这会让我感到有些沮丧。

    谢谢!

1 个答案:

答案 0 :(得分:0)

您在哪里为自己的应用创建了OAuth 2.0客户端?从您的屏幕截图中看来,这是Google API console中的条目。

您是否也在Google Play Developer console的游戏服务部分创建了一个条目(参见Google documentation中的第2步)?我在当前游戏中遇到了很大问题,因为我在OAuth 2.0中手动创建了Google API console客户端,而不是Google Play Developer console中的OAuth 2.0Google Developers ID都没有比赛。根据来自OAuth 2.0 Google Play Developer console的{​​{3}}客户端,只应在{{1}}中创建。我在video中写了更多关于我做错的事。

相关问题