2

以下页面https://developers.google.com/identity/toolkit/android/quickstart#step_3_set_up_the_quick-start_app告诉我

取消注释 identitytoolkit.api_key 元数据并将占位符替换为您的 API 密钥。您可以在标题为“ Android应用程序密钥”的公共 API 访问部分中找到您的 API 密钥。

而页面https://developers.google.com/identity/toolkit/android/告诉我相同的步骤

取消注释 identitytoolkit.api_key 元数据并将占位符替换为您的 API 密钥。您可以在标题为“浏览器应用程序密钥”的公共 API 访问部分中找到您的 API 密钥。

两个都试了,结果没区别,就是登陆不了。

我还尝试了不同的组合

取消注释 android:scheme 行并将占位符替换为您的反向服务器客户端 ID。您可以在标题为“ Web 应用程序的客户端 ID ”的 OAuth 部分中找到此 ID 。例如,如果您的服务器客户端 ID 是 123.apps.googleusercontent.com,则将 com.googleusercontent.apps.123 放在这里。

但所有这一切都变得有点连线了。

我什至不知道要问哪些问题才能解决这个问题,但如果文档表明某种值得信赖的“这就是你需要做的”,那就太好了。

Google 的某个人能否仔细检查两个站点中的“修改 AndroidManifest.xml ”部分并解释哪些信息是正确的?我有点困惑为什么我需要向 Android 应用程序添加这么多 Web 应用程序的东西。

提前致谢。

更新:得到它的工作,原来我在控制台中注册了错误的应用程序名称(它是一个不完整的路径)。此外,您使用哪个密钥似乎并不重要(我使用的是“ Android应用程序密钥”。)

4

1 回答 1

0

我希望它有所帮助。在Android 的快速启动应用程序中,您可以下载带有示例应用程序的 sdk,您可以在其中找到此 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2014 Google Inc. All Rights Reserved.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.identitytoolkit.demo"
    android:versionCode="1"
    android:versionName="1.0.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.google.identitytoolkit.demo.GitkitDemo"
            android:label="@string/app_name"
            android:launchMode="singleTask" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!-- Un-comment the following data tag and replace placeholder. -->
                <!--data
                    android:host="gitkit"
                    android:scheme="INSERT_REVERSED_SERVER_CLIENT_ID" /-->
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="identitytoolkit.show_providers"
            android:value="Google" />
        <meta-data
            android:name="identitytoolkit.use_google_plus"
            android:value="false" />
        <!-- Un-comment the following 3 meta-data tags and replace placeholder with the real value -->
        <!--meta-data
            android:name="identitytoolkit.api_key"
            android:value="INSERT_YOUR_API_KEY" /-->
        <!--meta-data
            android:name="identitytoolkit.server_client_id"
            android:value="INSERT_YOUR_SERVER_CLIENT_ID" /-->
        <!--meta-data
            android:name="identitytoolkit.server_widget_url"
            android:value="INSERT_YOUR_SERVER_WIDGET_URL" /-->
    </application>

</manifest>

此外,在Android 应用程序中使用身份工具包的教程中,您可以阅读需要替换的内容:

  • 取消注释 android:scheme 行并将占位符替换为您的反向服务器客户端 ID。您可以在标题为“Web 应用程序的客户端 ID”的 OAuth 部分中找到此 ID。例如,如果您的服务器客户端 ID 是 123.apps.googleusercontent.com,则将 com.googleusercontent.apps.123 放在这里。

  • 取消注释 identitytoolkit.api_key 元数据并将占位符替换为您的 API 密钥。您可以在标题为“浏览器应用程序密钥”的公共 API 访问部分中找到您的 API 密钥。

  • 取消注释 identitytoolkit.server_client_id 元数据并将占位符替换为您的服务器 OAuth2 客户端 ID。您可以在标题为“Web 应用程序的客户端 ID”的 OAuth 部分中找到此 ID。

  • 取消注释 identitytoolkit.server_widget_url 并将占位符替换为您的服务器端 Gitkit 小部件绝对 URL。此字段对于示例应用程序无关紧要,但您需要在设置 Web 服务器端点后对其进行配置。

正如我在开始时所说,我希望它有所帮助,我只是在处理这个教程,我来到你的问题,因为它很令人困惑......我不知道我是否让它工作了,还有很多工作要做做...

于 2015-08-18T16:33:27.753 回答