Connecting Tech Pros Worldwide Forums | Help | Site Map

"Authorization" Header not supported in AS3 ?

Newbie
 
Join Date: Oct 2007
Posts: 4
#1: Oct 21 '07
Hi, I am trying to use AS3 to make a URL request with authorization header. Using the code below:
var request:URLRequest = new URLRequest ( 'http://myserviceURL' );
var requestHeader:URLRequestHeader = new URLRequestHeader("Authorization", "AuthSub token=CI3xlrq1DxCjtruCAw");
request.requestHeaders.push(requestHeader);
...

But I get the following error:
ArgumentError: Error #2096: The HTTP request header Authorization cannot be set via ActionScript.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
...

But according to adobe's api reference, "Authorization" header should be allowed.
Any ideas? Thanks!

Newbie
 
Join Date: Jan 2008
Posts: 1
#2: Jan 2 '08

re: "Authorization" Header not supported in AS3 ?


Quote:

Originally Posted by dabei

Hi, I am trying to use AS3 to make a URL request with authorization header. Using the code below:
var request:URLRequest = new URLRequest ( 'http://myserviceURL' );
var requestHeader:URLRequestHeader = new URLRequestHeader("Authorization", "AuthSub token=CI3xlrq1DxCjtruCAw");
request.requestHeaders.push(requestHeader);
...

But I get the following error:
ArgumentError: Error #2096: The HTTP request header Authorization cannot be set via ActionScript.
at flash.net::URLStream/load()
at flash.net::URLLoader/load()
...

But according to adobe's api reference, "Authorization" header should be allowed.
Any ideas? Thanks!

Hi,

I currently encounter the same issue.
I have found that the Authorization header was added to the disallowed HTTP headers list recently (after flash player r47)
Did you find a workaround to make it work?

Thx in advance,

Eric
Newbie
 
Join Date: Jan 2009
Posts: 1
#3: Jan 15 '09

re: "Authorization" Header not supported in AS3 ?


hi all,

I did face the similar issue and i cant set request headers in flash AS3. Actually i m trying to download file from S3 Amazon Bucket, which can only be allowed if custom header is set in a request. I m trying to set that but when I check the request Packets from Etheral or WireShark, the request doesnt contain any of mine custom header.

here is my flash download code;

var headers:Array = new Array();

var authHeader:URLRequestHeader = new URLRequestHeader("Authorization","AWS: "+accesskey+":"+signature);
var dateHeader:URLRequestHeader = new URLRequestHeader("x-amz-date",date);

request.url = domainUrl+objectkey;
request.method = URLRequestMethod.GET;
headers.push(authHeader);
headers.push(dateHeader);

request.requestHeaders = headers;

trace('request:'+request.requestHeaders.length);

try {
loader.load(request);
}catch (error:Error) {
trace("Unable to load requested document.");
}

Remember I uploaded crossdomain.xml in the bucket with polies mentioned as under;

<cross-domain-policy>
<allow-access-from domain="*" secure="false" />
<site-control permitted-cross-domain-policies="all"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>


In order to download file from Amazon Bukcet the Request Packet should be;

GET /<bucketname>/<filename>HTTP/1.1
x-flash-version: 10,0,2,54
User-Agent: Shockwave Flash
Host: s3.amazonaws.com
Authorization: AWS:<accesskey>:<signature>
x-amz-date: <date>

but after doing all the above work my final request sent to amazon;

GET /<bucketname>/<filename>HTTP/1.1
x-flash-version: 10,0,2,54
User-Agent: Shockwave Flash
Host: s3.amazonaws.com


:( no custom header here;
plz can anyone suggests
Reply