我正在尝试使示例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