8

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.

akula1001
  • 4,576
  • 12
  • 43
  • 56

2 Answers2

1

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

Dave Mackintosh
  • 2,738
  • 2
  • 31
  • 40
0

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.

splintor
  • 9,924
  • 6
  • 74
  • 89