2

The following page https://developers.google.com/identity/toolkit/android/quickstart#step_3_set_up_the_quick-start_app tells me to

Uncomment the identitytoolkit.api_key meta data and replace the placeholder with your API key. You can find your API key in the Public API access section titled "Key for Android applications".

while the page https://developers.google.com/identity/toolkit/android/ tells me for the same step to

Uncomment the identitytoolkit.api_key meta data and replace the placeholder with your API key. You can find your API key in the Public API access section titled "Key for browser applications".

I tried both of them, the results didn't differ, I'm unable to sign in.

I also tried different combinations with

Uncomment the android:scheme line and replace the placeholder with your reversed server client ID. You can find this ID in the OAuth section titled "Client ID for web application". For example, if your server client ID is 123.apps.googleusercontent.com then put com.googleusercontent.apps.123 here.

but all of this is getting a bit wired.

I don't even know which questions to ask in order to get this issue solved, but it would be great if the documentation would indicate some sort of trustworthy "this is what you need to do".

Could somebody at Google double-check the "Modify AndroidManifest.xml" sections in both sites and explain which information would be correct? I'm a bit puzzled as to why I need to add so much web application stuff to the Android app.

Thanks in advance.

Update: Got it working, turned out I had the wrong app name registered in the console (it was an incomplete path). Also, it appears that it doesn't matter which Key you use (I'm using the "Key for Android applications".)

Daniel F
  • 13,684
  • 11
  • 87
  • 116

1 Answers1

0

I hope it helps. In the Quick-start app for Android you can download the sdk with a sample application where you will find this 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>

Also, in the tutorial to Use Identity Toolkit in your Android App you can read what you need to replace:

  • Uncomment the android:scheme line and replace the placeholder with your reversed server client ID. You can find this ID in the OAuth section titled "Client ID for web application". For example, if your server client ID is 123.apps.googleusercontent.com then put com.googleusercontent.apps.123 here.

  • Uncomment the identitytoolkit.api_key meta data and replace the placeholder with your API key. You can find your API key in the Public API access section titled "Key for browser applications".

  • Uncomment the identitytoolkit.server_client_id meta data and replace the placeholder with your server OAuth2 client ID. You can find this ID in the OAuth section titled "Client ID for web application".

  • Uncomment the identitytoolkit.server_widget_url and replace the placeholder with your server side Gitkit widget absolute URL. This field doesn't matter for the sample app, but you will need to configure it once you have the web server endpoint set up.

As I said at the beggining, I hope it helps, I'm just dealing with this tutorial and I came to your question because it was quite confussing... I don't know if I made it work yet, plenty of work to do yet...

Juan
  • 2,156
  • 18
  • 26
  • Hi, thanks, I already got it working. My issue was that I had the the wrong android app name in the console (had an incomplete name). My issue in the post above was that the documentation wasn't clear if "Key for browser applications" or "Key for Android applications" should be used. It turned out that this key is totally irrelevant. I also got the app working by placing the string "somestuff" in that key. I was a bit annoyed by the documentation which is spread all over the place. You're basically just quoting the docs. I wish you good luck, also with the backend. – Daniel F Aug 18 '15 at 20:40