Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
401在Android应用程序中使用谷歌云API的响应_Android_Google App Engine_Google Cloud Storage - Fatal编程技术网

401在Android应用程序中使用谷歌云API的响应

401在Android应用程序中使用谷歌云API的响应,android,google-app-engine,google-cloud-storage,Android,Google App Engine,Google Cloud Storage,我正在尝试在我的应用程序中使用Google AppEngine(以取代AWS)。我让数据存储使用以下代码: themeendpoint.Builder endpointBuilder = new themeendpoint.Builder( AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new HttpRequestInitializer() {

我正在尝试在我的应用程序中使用Google AppEngine(以取代AWS)。我让数据存储使用以下代码:

themeendpoint.Builder endpointBuilder = new themeendpoint.Builder(
            AndroidHttp.newCompatibleTransport(),
            new JacksonFactory(),
            new HttpRequestInitializer() {
                public void initialize(HttpRequest httpRequest) { }
            });

    themeendpoint endpoint = CloudEndpointUtils.updateBuilder(
            endpointBuilder).build();
    DbAdapter dbAdapter = new DbAdapter(mCtx);
    try {
        CollectionResponseTheme response = endpoint.listTheme().execute();        
        List<Theme> listResponse = response.getItems();
...
我得到以下错误:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
{
  "code" : 401,
"errors" : [ {
"domain" : "global",
"location" : "Authorization",
"locationType" : "header",
"message" : "Login Required",
"reason" : "required"
 } ],
  "message" : "Login Required"
}

在云控制台中,我将Google云存储设置为“On”。特定的bucket权限设置为“所有用户”=“读卡器”。我缺少什么?

当您尝试读取对象时,不需要bucket权限。相反,您需要将对象权限设置为公共读取

您可以通过云控制台或通过gsutil从命令行修复对象权限。命令是:

gsutil acl set public-read gs://bucketName/objectName

如果我不想公开呢?我只希望我的应用程序能够下载它。这是一个令人惊讶的深刻问题。任何匿名用户都可以下载并安装您的应用程序吗?他们是否需要建立某种帐户才能被允许下载该对象?如果你有某种方法来验证受信任的用户,将签名的URL交给这些用户是解决这个问题的标准方法。理论上,没有匿名用户可以下载它,因为它只在Google play中,每个人都会有一个gumshoe帐户。但我不想使用oauth2,因为这需要用户从弹出窗口获得许可(据我所知)
gsutil acl set public-read gs://bucketName/objectName