谷歌小工具和网站 API

发布于 2024-08-17 03:00:28 字数 495 浏览 3 评论 0原文

我正在编写一个谷歌小工具(只是简单的 html + javascript),使用站点 API 将文件上传到私人谷歌站点。 http://code.google.com/apis/sites/ docs/1.0/developers_guide_protocol.html#UploadingFiles

我只能使用多部分表单上传文件。但它不起作用,因为 api 需要 oauth 身份验证。身份验证涉及在 POST 请求中设置一些标头字段。不幸的是,表单提交不允许我们设置标头,因此无法进行身份验证。由于跨域限制,我无法进行ajax调用。关于可以做什么的任何想法?

我能想到的一种方法是使用进行经过身份验证的调用的代理,但我想避免这种情况。我需要一种仅使用 javascript 的方法。

I'm writing a google gadget (nothing but plain html + javascript) to upload a file onto a private google site using the sites api. http://code.google.com/apis/sites/docs/1.0/developers_guide_protocol.html#UploadingFiles

I can only upload the file using a multi-part form. But it doesn't work because the api needs oauth authentication. Authetication involves setting some header fields in the POST request. Unfortunately form submit does not let us set the header, thus no authentication. I can't make an ajax call because of cross-domain restrictions. Any ideas on what can be done?

One way I can think of is to use a proxy which makes the authenticated call, but I want to avoid that. I need a javascript-only way of doing it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠北森屋 2024-08-24 03:00:28

发布到服务器端脚本并使用您想要的所有标头发起curl 请求?

post to a server side script and initiate a curl request with all the headers you want?

清醇 2024-08-24 03:00:28

我正在看同样的问题。我现在找到了适用于 JavaScript 的 Google API 客户端库。我不知道它是否支持 Google 协作平台,但我打算尝试一下。

I'm looking at the same problem. I now found Google APIs Client Library for JavaScript. I don't know if it supports Google Sites, but I plan to try.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文