Google Drive API错误“警告:无法更改所有者/任何人的权限” [英] Google Drive API Error "WARNING: unable to change permissions for owner/everbody"

查看:791
本文介绍了Google Drive API错误“警告:无法更改所有者/任何人的权限”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图允许我编写的程序访问Google云端硬盘应用程序。我已成功获取客户机密信息,并复制并粘贴示例代码,并尝试使用它来成功验证我的程序并使用Google Drive API。



然而,当它到达线路时

 凭证凭证=新的AuthorizationCodeInstalledApp(流程,新的LocalServerReceiver())。authorize(user) ; 

我得到这个错误。这个错误之前已经发布过,我基本上都尝试过所有的解决方案。我已经将我的程序和所有java.exe文件提升为管理员,并尝试运行该程序,但仍然出现此错误。



完整的错误是:

  2015年10月3日11: 48:39 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly 
警告:无法更改每个人的权限:D:\directory
Oct 03,2015 11:48:39 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
警告:无法更改所有者权限:D:\目录

当我实例化FileDataStoreFactory但也失败时,我也尝试覆盖setPermissionToOwnerOnly。



我试过以下解决方案:

  http:// stackoverflow.com/questions/30634827/warning-unable-to-change-permissions-for-everybody 
http://stackoverflow.com/questions/24382069/error-while-executing-google-prediction-api-command -line-sample
https://groups.google.com/forum/#!topic/google-analytics-data-export-api/-7BH7Z40gkw(其中客户机秘密数据被硬编码到程序中,此是坏的,我知道,但它不起作用)

我不知道该怎么做在这一点上做。我正在使用闪存驱动器运行我的程序,并试图从我的计算机上运行它,但仍然失败。我使用的是NetBeans 8.0.2。



这个错误是一个警告,所以也许有一些方法可以忽略警告并继续?这可能是一个解决方案,但我已经研究过,我不确定这是否有可能。我正在运行Windows 10,如果这很重要。

解决方案

我刚刚运行Drive REST API示例 Java快速入门教程,并且工作正常。如果您尚未安装 Gradle ,则需要一些安装时间(Eclipse Marketplace还有一个插件用于摇篮)。

至此,我确实收到了相同的警告信息。但是,它在 authorize()方法中的加载客户端密钥期间发生。

  public static Credential authorize()throws IOException {
//加载客户机密。
InputStream in =
DriveQuickstart.class.getResourceAsStream(/ client_secret.json);
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY,new InputStreamReader(in));

我怀疑这是您的问题发生的地方。因为,我无法从代码片段中看到该部分,请查看您的 client_secret.json 文件的位置。



希望这可以帮助。祝你好运!


I've been trying to allow a program I am writing to access Google Drive Applications. I have gotten the client secrets information successfully, and have copy and pasted the example code and tried using it to successfully authenticate my program and use the google drive API.

However, when it gets to the line

    Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");

I get this error. This error has been posted about before, and I've tried essentially every solution. I've elevated both my program and all the java.exe files to administrator and tried running the program and I still got this error.

The full error is:

    Oct 03, 2015 11:48:39 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
    WARNING: unable to change permissions for everybody: D:\directory
    Oct 03, 2015 11:48:39 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
    WARNING: unable to change permissions for owner: D:\directory

I've also tried overriding the setPermissionToOwnerOnly when I instantiated the FileDataStoreFactory but that failed as well.

I have tried the following solutions:

http://stackoverflow.com/questions/30634827/warning-unable-to-change-permissions-for-everybody
http://stackoverflow.com/questions/24382069/error-while-executing-google-prediction-api-command-line-sample
https://groups.google.com/forum/#!topic/google-analytics-data-export-api/-7BH7Z40gkw (where the client secret data was hard coded into the program, this is bad, I know, but it didn't work anyway)

I don't know what to do at this point. I am running my program off a flash drive, and I tried running it off my computer as well, but it still failed. I am using NetBeans 8.0.2.

The error comes up as a warning, so maybe there is some way to just ignore the warning and proceed? That could be a solution, but I've researched and I'm not sure if that's a possibility. I am running windows 10 if that matters.

解决方案

I just ran the Drive REST API example Java Quickstart tutorial through Eclipse and is working fine. It does requires a bit of setup time if you have not install Gradle (also Eclipse Marketplace has a plugin for Gradle).

To your point, I did get the same warning messages. However, it happened for me during the load client secret in the authorize() method.

public static Credential authorize() throws IOException {
    // Load client secrets.
    InputStream in =
        DriveQuickstart.class.getResourceAsStream("/client_secret.json");
    GoogleClientSecrets clientSecrets =
        GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));

I suspect this is where your issue is happening. Since, I am not able to see that part from your code snippet, have a look at where your client_secret.json file is located.

Hope this helps. Good luck!

这篇关于Google Drive API错误“警告:无法更改所有者/任何人的权限”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆