user3078302
user3078302

Reputation: 1

How to use ActionScript to issue a HTTP GET with an Authorization header

I am using Adobe Flash ActionScript 3.0 to upload and download a file from box.com. I am in the process of converting my code from using v1 to v2 of the box.com API. I was able to get the OAuth process to work (I get the access_token). However, I am not able to download a file. This is because downloading a file from box.com requires a GET with a header containing:

“Authorization: Bearer ”. (Reference: http://developers.box.com/docs/#files-download-a-file)

However, ActionScript does not support this:

Due to browser limitations, custom HTTP request headers are only supported for POST requests, not for GET requests. (From: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#requestHeaders)

If anybody knows a workaround for this, any pointers will be greatly appreciated.

Upvotes: 0

Views: 1370

Answers (1)

Peter
Peter

Reputation: 2599

Are you sure that you can't send the Authorization header? I'm pretty sure we've got a bunch of ActionScript developers that have figured out how to do it. Hopefully someone from that community can chime in with the actual recommended calls to make.

The Authorization HTTP header which we expect to contain the access token, is not a custom HTTP header. So I don't think it should be a problem. The documentation for the URLRequestHeader class says that there's a distinction between content running within and outside the application security sandbox and what headers can be used. Is it possible that you don't have your code correctly tagged as within the application security sandbox?

I'm no ActionScript coder, but the doc looks like you can set the Authorization header:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequestDefaults.html

Upvotes: 0

Related Questions