So I'd need to use the Socket class, pass across the HTTP headers (just like a real http request) and then parse the response?
Seems like I might be better off writing a PHP proxy for BaseCamp that doesn't require authentication. Thanks! - Jason. --- In [email protected], "Carson Hager" <[EMAIL PROTECTED]> wrote: > > Unfortunately, Flex does not support the ability to supply basic auth > credentials from the client. I've been able to do this using the Socket > class but it required manual parsing of the http result in its raw > form...doable but not pretty. > > > Carson > > ____________________________________________ > > Carson Hager > Cynergy Systems, Inc. > http://www.cynergysystems.com <http://www.cynergysystems.com/> > > Email: [EMAIL PROTECTED] > Office: 866-CYNERGY > Mobile: 1.703.489.6466 > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Jason > Sent: Thursday, February 15, 2007 2:57 PM > To: [email protected] > Subject: [flexcoders] Basic Authorization in HTTPService without using > Flex Data Services > > > > The following mxml file attempts to connect to BaseCamp to retrieve a > list of Projects. The problem is how to specify the basic > authorization. I notice that setCredentials() does not work with > direct http connections (no proxying). > > Any other ideas? (The username and passwords are all valid - I created > a new basecamp project for this testing). > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> "> > > <mx:VBox width="100%" height="100%" horizontalAlign="center" > verticalAlign="middle"> > > <mx:Panel> > <mx:Form> > <!-- <mx:FormItem label="Username:"> > <mx:TextInput id="txtUsername"/> > </mx:FormItem> > <mx:FormItem label="Password:"> > <mx:TextInput id="txtPassword" displayAsPassword="true"/> > </mx:FormItem> > <mx:FormItem label="Path:"> > <mx:TextInput id="txtPath"/> > </mx:FormItem> --> > <mx:FormItem> > <mx:Button label="Login" click="getProjects()"/> > </mx:FormItem> > </mx:Form> > > <mx:TextArea width="100%" height="100" id="txtResults"/> > > > </mx:Panel> > > </mx:VBox> > > <mx:HTTPService > concurrency="single" > contentType="application/xml" > resultFormat="xml" > makeObjectsBindable="true" > id="feedRequest" > url="http://flexexample.projectpath.com/project/list > <http://flexexample.projectpath.com/project/list> " > method="POST" > useProxy="false" > fault="handleFault(event)" > result="handleResult(event)"> > <mx:request> > <request> > </request> > </mx:request> > </mx:HTTPService> > > <mx:Script> > <![CDATA[ > > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > > public function getProjects() : void { > // the username is flexexample > // the password is flexexample > feedRequest.headers = > { > Authorization: "Basic ZmxleGV4YW1wbGU6ZmxleGV4YW1wbGU=", > Accept: "application/xml" > }; > feedRequest.send(); > } > > public function handleFault(event:FaultEvent) : void { > txtResults.text = "FAULT: " + event.toString(); > } > > public function handleResult(event:ResultEvent) : void { > txtResults.text = "RESULT: " + event.result.toString(); > } > > ]]> > </mx:Script> > > </mx:Application> >

