google-sheets - 非法参数异常 : Trying to set foreign cookie while downloading Google Spreadsheet via API?

标签 google-sheets google-drive-api google-docs google-sheets-api illegalargumentexception

我正在尝试使用下载 API 版本 3 ( v3 ) 下载 Google 电子表格。下载电子表格时收到“java.lang.IllegalArgumentException:尝试设置外部 cookie”错误消息。我通过我的谷歌应用程序帐户进行了尝试,该帐户是通过 2 条腿的 oauth 身份验证过程进行身份验证的。有人遇到这样的问题吗?

这是错误堆栈跟踪:

Servlet.service() for servlet action threw exception|java.lang.IllegalArgumentException: Trying to set foreign cookie
    at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookie.<init>(GoogleGDataRequest.java:166)
    at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookieHandler.put(GoogleGDataRequest.java:399)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:710)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2053)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderFields(HttpsURLConnectionImpl.java:263)
    at com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse(HttpGDataRequest.java:558)
    at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:549)
    at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
    at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)

编辑:此问题仅发生在使用我们应用程序的一个用户帐户中。对于所有其他用户来说它工作正常

最佳答案

我遇到了同样的问题,并通过更改网址解决了它。

我直接从 GDrive 获取的 URL:

https://docs.google.com/spreadsheets/d/19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o/edit#gid=1472457471

必须将上面的内容修改为:

https://spreadsheets.google.com/feeds/spreadsheets/**19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o

希望这会对某人有所帮助。

关于google-sheets - 非法参数异常 : Trying to set foreign cookie while downloading Google Spreadsheet via API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22321873/

相关文章:

javascript - 如何访问 Google Apps For Your Domain 电子表格的 JSONP 提要?

google-app-engine - 为 google api 设置 oauth2.0 key

c# - 如何使用 OAuth 在 C# 中创建新的 Google Drive 服务

javascript - 如何使用 Google 脚本将特定列从 google 工作表提取到 google 文档?

Excel 公式转 Google 文档格式

google-apps-script - 在 Google 电子表格事件上运行 Google Apps 脚本?

google-sheets - 谷歌表格: ArrayFormula with CountBlank

javascript - 谷歌电子表格 - ajax 调用(获取和发布)

google-sheets - 有没有办法检索电子表格中最右边的非空单元格?谷歌表格

python - 无法修改 PyCharm 上的只读目录