Suggestions needed to prevent login prompt from calling API by Flex

Newsgator Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Suggestions needed to prevent login prompt from calling API by Flex Expand / Collapse
Author
Message
Posted 2/6/2008 2:16:06 PM
Forum Member

Forum Member

Group: Forum Members
Last Login: 2/8/2008 3:02:50 PM
Posts: 1, Visits: 9
we are interested in using NewsGator API for our News service. I am doing some prototypings right now to use our frontend Flex actionscript to call the corresponding REST API. I have difficulties to get around with the Authentication prompt by wrapping user credentials in actionscript code. I tried HTTPService and URLRequest. Tried encoding vs non-encoding. So far none is working yet. Below is a section of code, please give me some suggestions.

Thanks
----------------------
var request:URLRequest = new URLRequest(https://services.newsgator.com/ngws/svc/Subscription.aspx/ALocation/headlines);
request.method = URLRequestMethod.POST;
var encoder:Base64Encoder = new Base64Encoder();
var str:String = "username:password";
var size:uint = str.length;
encoder.encode(str, 0, size-1);
var base64EncodedCredentials:String = encoder.flush();
var header1:URLRequestHeader = new URLRequestHeader("X-NGAPIToken", "YOURTOKEN");
var header2:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + base64EncodedCredentials);
request.requestHeaders = [header1, header2];
var loader:URLLoader = new URLLoader();

//listen for when the data loads
loader.addEventListener(Event.COMPLETE, showHeadlineOnCreateComplete);
loader.load(request);
Post #36667
« Prev Topic | Next Topic »


All times are GMT -7:00, Time now is 1:36am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.141. 5 queries. Compression Disabled.

NewsGator.com | Support | Developers | Partners | Press | Company
© Copyright 2003-2008  NewsGator Technologies, Inc. All Rights Reserved.
Copyright Information | Privacy Policy | Terms of Service
Microsoft Gold Certified Partner