473,414 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

"Authorization" Header not supported in AS3 ?

4
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!
Oct 21 '07 #1
5 14078
emahe
1
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
Jan 2 '08 #2
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
Jan 15 '09 #3
mfharis: When I sent,

Expand|Select|Wrap|Line Numbers
  1. var protocol:String = (secure) ? "https" : "http";
  2.             var req:URLRequest = new URLRequest(protocol + "://" + AMAZON_ENDPOINT + resource);
  3. req.method = method;
  4.             var dateString:String = getDateString(new Date());
  5. var dateHeader:URLRequestHeader = new URLRequestHeader("Date", dateString);
  6.             var authHeader:URLRequestHeader = new URLRequestHeader("Authorization", getAuthenticationHeader(method, dateString, resource, contentType, hash));
  7.             req.requestHeaders.push(dateHeader);
  8.             req.requestHeaders.push(authHeader);
  9.  
  10. var req1:URLRequest = getURLRequest("GET", "/" + escape(bucketName));                    
  11.                 stream.load(req); 
  12.  
throws Error #2096: The HTTP request header Date cannot be set via ActionScript.
Please help someone to step forward.
Aug 27 '12 #4
Fary4u
273 100+
i've got the same problem have you fix this ?
Sep 27 '12 #5
Authorization header is not supported by flash player. Have look of this http://help.adobe.com/en_US/FlashPla...estHeader.html
Sep 27 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
0
by: Kristofer Liljeblad | last post by:
Hi, I've successfully setup my machine to use: sessionState mode="SQLServer". All is up and running so no problems so far. Because I curious person, I started to play around with the two new...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
1
by: Menno Abbink | last post by:
Hey All, I'm developing a new website and I want the customer to be able to se my work in progress so I have set up a server behind my ADSL-router. The server is using W2003. I've created a...
4
by: samadams_2006 | last post by:
Hello, I have a peculiar problem that I'm hoping someone can help me out with. I have a simple enough Web Application written in VB.Net via Visual Studio 2003. It simply displays a Web Form...
2
by: Tor Inge Rislaa | last post by:
I am prompted to implement the syntax below to be able to monitor the error on the remote server trough my browser (client). I can't seem to find where to place the code in my web.config file to...
2
by: Ottavio | last post by:
Hello, I'm having some problems with the authentication during a web service call I know I have to add the "Authorization: Basic xxxxxxxx" in the http header (not soap header) but I can't find a...
4
by: R.A.M. | last post by:
Hello, I am writing my first ASP.NET application (I use .NET 2.0, Visual Web Developer 2005 Express Edition and SQL Server 2005 Express Edition). The application builds successfully but when I try...
18
by: =?Utf-8?B?VG9t?= | last post by:
is it possible to add a bunch of users to group and only allow group to access the web page or do I need to add each user to the web.config file? Or is there another way to do this? I just took...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.