Index: ApiMain.php
===================================================================
--- ApiMain.php	(revision 27064)
+++ ApiMain.php	(working copy)
@@ -93,13 +93,25 @@
 	* @param $enableWrite bool should be set to true if the api may modify data
 	*/
 	public function __construct($request, $enableWrite = false) {
+		global $wgRequest; //eroger
 
 		$this->mInternalMode = ($request instanceof FauxRequest);
 
 		// Special handling for the main module: $parent === $this
 		parent :: __construct($this, $this->mInternalMode ? 'main_int' : 'main');
 
+		//Check if request has ccokie-like variables, and set them.  - eroger
+		if( ($request->getVal('lgtoken')) && ($request->getVal('lgusername')) && ($request->getVal('lguserid')) ) {
+			
+			// Got variables, set cookies. 
+			$_SESSION['wsUserID'] = $request->getVal('lguserid');
+			$_SESSION['wsUserName'] = $request->getVal('lgusername');
+			$_SESSION['wsToken'] = $request->getVal('lgtoken');
+			
+		} 
+		
 		if (!$this->mInternalMode) {
+	
 			
 			// Impose module restrictions.
 			// If the current user cannot read, 
