我正在嘗試使示例android client正常工作。什麼是Google Cloud Endpoints的Web應用程序客戶端ID?
我停留在的安裝說明第4步:用
更新中的src/COM觀衆的值/谷歌/ devrel /樣品/ TTT/ClientCredentials.java,替換字符串 「your_web_client_id」您在API控制檯中註冊的Web應用程序客戶端ID。
這是我需要改變的代碼行:由「網絡應用客戶端ID」
public static final String AUDIENCE = "server:client_id:your_web_client_id";
我不知道他們是什麼意思。我在GAE上啓動並運行了Java後端,但沒有對API控制檯進行任何操作。
任何想法?
編輯
這裏是爲Java後端客戶端ID代碼:
/**
* Contains the client IDs for allowed clients consuming the tictactoe API.
*/
public class Ids {
public static final String WEB_CLIENT_ID = "240003018828.apps.googleusercontent.com";
public static final String ANDROID_CLIENT_ID = "240003018828-rp5ahj5b1eo76g55m1qtq4vvm57dqoj6.apps.googleusercontent.com";
public static final String IOS_CLIENT_ID = "replace this with your iOS client ID";
public static final String ANDROID_AUDIENCE = WEB_CLIENT_ID;
}
下面是在Android項目的客戶ID代碼:
public class ClientCredentials
{
public static final String AUDIENCE = "server:client_id:240003018828-rp5ahj5b1eo76g55m1qtq4vvm57dqoj6.apps.googleusercontent.com";
// public static final String AUDIENCE = "server:client_id:your_web_client_id";
}
而且也來自android項目:
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://sample-ttt.appspot.com/_ah/api/";
好的,這是有道理的。這是否意味着我需要在API控制檯中有一個項目?因爲現在我只有java後端項目和android客戶端項目,都構成github。 – Felix 2013-02-20 00:12:08
是的,您應該在API控制檯中創建一個項目。 – 2013-02-20 00:50:36
好吧,我創建了兩個客戶端ID並將它們放入項目中。現在,當Android嘗試連接到java後端時,我得到一個GoogleAuthIOException。這是否意味着我有一個錯誤的ID?我是否需要在API控制檯中爲我的項目啓用一些服務? – Felix 2013-02-20 01:22:28