1 Reply Latest reply on May 9, 2008 10:55 PM by nyvirus_1

    Authorization problem

    nyvirus_1
      Hi,

      I'm trying to pull a private feed from friendfeed with an AIR application, and I keep getting an error that something went wrong on the FF server which results in this error on my side:
      [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: app:/friendfeed.com/api/feed/user/nyvirus1" errorID=2032]

      However I know there's nothing wrong with the FF server because www.alertthingy.com works perfectly, and it is also an AIR application that does not use the default AIR pop-up for authorization.

      So what I decided to do was use the same model only on Twitter, for some reason everything went through fine.

      I later got a friend of mine to write a Ruby script to test the two services and he was also only able to get through to Twitter.

      The only difference in the two services is that Twitter has a special URL to test credentials: http://twitter.com/account/verify_credentials.xml
      and FF doesn't. But that still doesn't make sense, because if I use the default authorization pop-up I can pull the private feed I'm requesting.

      Here are the two simple models, I'd really appreciate your help, you can test the actual code for FF, I will reset my remote key later.


      Twitter:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="twitterRequest()">
      <mx:Script>
      <![CDATA[
      import flash.net.URLRequest;
      import flash.net.URLRequestHeader;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      import flash.events.Event;

      private var loader:URLLoader = new URLLoader();

      private function twitterRequest():void{
      loader.addEventListener("complete", sendAuthStuff);
      loader.addEventListener("ioError", sendAuthStuff);

      var r:URLRequest = new URLRequest(" http://twitter.com/account/verify_credentials.xml");
      var login64:String = "xxxxxxx"; // the encrypted key goes here username:password
      var rArray:Array = new Array(new URLRequestHeader ("Authorization", "Basic " + login64));

      r.requestHeaders = rArray;
      r.method = URLRequestMethod.POST;
      loader.load(r);
      }

      private function sendAuthStuff(ev:Event)
      {
      trace(ev);
      trace(loader.data);
      }

      ]]>
      </mx:Script>
      </mx:WindowedApplication>


      FriendFeed:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="ffRequest()">
      <mx:Script>
      <![CDATA[
      import flash.net.URLRequest;
      import flash.net.URLRequestHeader;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      import flash.events.Event;

      private var loader:URLLoader = new URLLoader();

      private function ffRequest():void{
      loader.addEventListener("complete", sendAuthStuff);
      loader.addEventListener("ioError", sendAuthStuff);

      var r:URLRequest = new URLRequest("friendfeed.com/api/feed/user/nyvirus1");
      var login64:String = "bnl2aXJ1czE6bGludHM2ODBub3Q=";
      var rArray:Array = new Array (new URLRequestHeader ("Authorization", "Basic " + login64));

      r.data = "";
      r.requestHeaders = rArray;
      r.method = URLRequestMethod.POST;
      loader.load(r);
      }

      private function sendAuthStuff(ev:Event)
      {
      trace(ev);
      trace(loader.data);
      }

      ]]>
      </mx:Script>
      </mx:WindowedApplication> Text