0

我有一个 Android 应用程序可以通过 Google Endpoints 访问一组 API。问题是可以通过https://your-app-id.appspot.com/_ah/api/explorer从网络访问相同的 API ,我不希望这种情况发生。也就是说,我希望只能从移动设备访问(和修改)数据存储。有没有一种简单的方法可以做到这一点?我查看了 enpoint authentification 并没有完全理解这一点(我对这一切仍然很陌生......),所以我想知道这个(显然)简单的问题是否有更简单的答案。

4

2 回答 2

0

In order to restrict access to the API to only apps that you've written you will need to implement authenticated API calls.

The second set of instructions in the README for https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-android detail how to register your app with Google Play Services in order to authenticate your app and users.

https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-java-maven/blob/master/src/main/java/com/google/devrel/samples/helloendpoints/Greetings.java#L50 shows an authenticated Cloud Endpoints method implementation. If an invocation happens on that method that isn't authenticated the User object will be null.

于 2013-09-06T01:03:40.330 回答
0

目前无法改变您的端点在网络上公开可见的事实(等)。

但是,您可以实施身份验证以确保它们仅由您的客户端(无论是移动设备还是 Web)使用。您可以在客户端设备上对 Google 帐户进行身份验证,也可以只对您的应用进行身份验证。

相关文档在这里: https ://developers.google.com/appengine/docs/java/endpoints/consume_android

这里也有一些:
https ://developers.google.com/eclipse/docs/endpoints-addauth

不幸的是,两者都不是很好,它们更关注用户(与应用程序)身份验证。因此,如果您有问题,我还建议您使用“[google-app-endpoints]authentication”搜索 SO。

于 2013-09-04T16:00:34.577 回答