Move getAccessToken logic to the connection
[potlatch2.git] / net / systemeD / halcyon / connection / XMLConnection.as
index 30d3915a32c927d316e1e783cc9c2cd13ee5fc44..951f083f58ae520ab79b544aeb622f43cdad28c6 100644 (file)
@@ -60,6 +60,22 @@ package net.systemeD.halcyon.connection {
                authToken = OAuthToken(id);
            }
 
+        override public function getAccessToken(data:Object):OAuthToken {
+            var key:String = Connection.getParam("oauth_token", null);
+            var secret:String = Connection.getParam("oauth_token_secret", null);
+
+            if ( key == null || secret == null ) {
+                //var data:Object = SharedObject.getLocal("access_token").data;
+                key = data["oauth_token"];
+                secret = data["oauth_token_secret"];
+            }
+
+            if ( key == null || secret == null )
+                return null;
+            else
+                return new OAuthToken(key, secret);
+        }
+
         private var httpStatus:int = 0;
         
         private function recordStatus(event:HTTPStatusEvent):void {