如何在Flash播放器中使用Google Drive API?

时间:2013-07-05 08:57:44

标签: actionscript-3 google-drive-api flash

我想在我的flash组件中使用google drive api。

我获得了访问密钥,但我无法使用google drive api。 我想将文件插入谷歌驱动器。

var urlLoader:MultipartURLLoader = new MultipartURLLoader();

urlLoader.addEventListener(Event.COMPLETE, uploadCompleteHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, uploadIOErrorHandler);
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, uploadSecurityErrorHandler);

urlLoader.requestHeaders.push(new URLRequestHeader("Authorization", authorization));
urlLoader.load('https://www.googleapis.com/upload/drive/v2/files');

我收到以下错误

[SecurityErrorEvent type="securityError" bubbles=false cancelable=false 
eventPhase=2 text="Error #2170: Security sandbox violation:
http://myserver.com/myflash.swf cannot send 
HTTP headers to https://www.googleapis.com/upload/drive/v2/files."]

https://www.googleapis.com/crossdomain.xml

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/crossdomain-policy.dtd">
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="master-only"/>
  <allow-access-from domain="*.google.com" secure="false"/>
  <allow-access-from domain="*.doubleclick.com" secure="false"/>
  <allow-access-from domain="*.doubleclick.net" secure="false"/>
  <allow-access-from domain="*.gstatic.com" secure="false"/>
  <allow-access-from domain="*.teracent.net" secure="false"/>
  <allow-access-from domain="*.2mdn.net" secure="false"/>
  <allow-access-from domain="*.youtube.com" secure="false"/>
  <allow-access-from domain="*.ytimg.com" secure="false"/>
  <allow-http-request-headers-from domain="*" headers="Accept,Accept-Language,Authorization,Cache-Control,Content-Disposition,Content-Encoding,Content-Language,Content-Length,Content-MD5,Content-Range,Content-Type,Date,GData-Version,Host,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,Origin,OriginToken,Pragma,Range,Slug,Transfer-Encoding,X-ClientDetails,X-GData-Client,X-GData-Key,X-Goog-AuthUser,X-Goog-Encode-Response-If-Executable,X-Goog-Upload-Command,X-Goog-Upload-Content-Disposition,X-Goog-Upload-Content-Length,X-Goog-Upload-Content-Type,X-Goog-Upload-Offset,X-Goog-Upload-Protocol,X-HTTP-Method-Override,X-JavaScript-User-Agent,X-Origin,X-Referer,X-Upload-Content-Length,X-Upload-Content-Type,X-Use-HTTP-Status-Code-Override,X-YouTube-VVT"/>
</cross-domain-policy>

我的服务器crossdomain.xml

<cross-domain-policy>
  <allow-access-from domain="*"/>
  <site-control permitted-cross-domain-policies="all"/>
  <allow-http-request-headers-from domain="*"/>
</cross-domain-policy>
某人可以告诉我一个解决方案

0 个答案:

没有答案