谷歌小工具和网站 API
我正在编写一个谷歌小工具(只是简单的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发布到服务器端脚本并使用您想要的所有标头发起curl 请求?
post to a server side script and initiate a curl request with all the headers you want?
我正在看同样的问题。我现在找到了适用于 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.