Flash and Google Drive SDK cannot talk to each oth

2019-04-12 20:35发布

问题:

I need to create a flash web app connecting to Google Drive SDK to retrieve a public binary file but I am facing cross domain security issues.

I am able to do it in javascript using cross-site xmlhttprequest with CORS. In AS3, a crossdomain.xml file is requested on docs.google.com. However the current settings don't let flash access the file.

The solution I have as of now is to get the data using javascript and send it to the swf using ExternalInterface.

Is there any better solution (proxy is not an option in my case)?

Edit: it seems that the ideal solution will be to grant access to authorization headers in https://docs.google.com/crossdomain.xml :

<cross-domain-policy>
     <allow-http-request-headers-from domain="*" headers="Authorization">
      </allow-http-request-headers-from>
</cross-domain-policy>

This change will give the same security rights to Flash API than Javascript.

Can the google drive sdk team comment on it?

回答1:

CORS works for most operations with the Google Drive API. As you rightly say, you can use the Google JavaScript Client and use ExternalInterface. I would probably prefer this solution right now depending on exactly what you are doing.