Index: sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php
===================================================================
--- sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php	(revision 6352)
+++ sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php	(revision 6367)
@@ -183,12 +183,14 @@
 			$ch = curl_init();
 
+			$restConf = parse_ini_file( __DIR__ . '/../../../prototype/config/REST.ini', true );
+
 			$param  = 'grant_type=password';
-			$param .= '&client_id=' . $GLOBALS['oauth']['client_id'];
-			$param .= '&client_secret=' . $GLOBALS['oauth']['client_secret'];
+			$param .= '&client_id=' . $restConf['oauth']['client_id'];
+			$param .= '&client_secret=' . $restConf['oauth']['client_secret'];
 			$param .= '&username=' . $_POST['user'];
 			$param .= '&password=' . $_POST['passwd'];
 
 			// set URL and other appropriate options
-			curl_setopt($ch, CURLOPT_URL, $GLOBALS['oauth']['url_token']);
+			curl_setopt($ch, CURLOPT_URL, $restConf['oauth']['url_token']);
 			curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*'));
 			curl_setopt($ch, CURLOPT_POST, TRUE);
@@ -210,5 +212,4 @@
 				$_SESSION['oauth']['scope'] = $a->scope;
 				$_SESSION['oauth']['refresh_token'] = $a->refresh_token;
-				
 				
 			}
Index: sandbox/2.4.1-3/prototype/config/oauthCode.ini
===================================================================
--- sandbox/2.4.1-3/prototype/config/oauthCode.ini	(revision 6351)
+++ sandbox/2.4.1-3/prototype/config/oauthCode.ini	(revision 6367)
@@ -1,4 +1,4 @@
 service = PostgreSQL
-PostgreSQL.concept = auth_codes
+PostgreSQL.concept = rest_auth_code
 
 [PostgreSQL.mapping]
Index: sandbox/2.4.1-3/prototype/config/oauthToken.ini
===================================================================
--- sandbox/2.4.1-3/prototype/config/oauthToken.ini	(revision 6351)
+++ sandbox/2.4.1-3/prototype/config/oauthToken.ini	(revision 6367)
@@ -1,4 +1,4 @@
 service = PostgreSQL
-PostgreSQL.concept = access_tokens
+PostgreSQL.concept = rest_access_token
 
 [PostgreSQL.mapping]
Index: sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini
===================================================================
--- sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini	(revision 6351)
+++ sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini	(revision 6367)
@@ -1,4 +1,4 @@
 service = PostgreSQL
-PostgreSQL.concept = refresh_tokens
+PostgreSQL.concept = rest_refresh_token
 
 [PostgreSQL.mapping]
@@ -8,3 +8,3 @@
 expires = expires
 scope = scope
-refresh_token = refresh_token
+refresh_token = refresh_tokenr
Index: sandbox/2.4.1-3/prototype/config/oauthCliente.ini
===================================================================
--- sandbox/2.4.1-3/prototype/config/oauthCliente.ini	(revision 6351)
+++ sandbox/2.4.1-3/prototype/config/oauthCliente.ini	(revision 6367)
@@ -1,4 +1,4 @@
 service = PostgreSQL
-PostgreSQL.concept = clients
+PostgreSQL.concept = rest_client
 
 [PostgreSQL.mapping]
Index: sandbox/2.4.1-3/prototype/api/config.php
===================================================================
--- sandbox/2.4.1-3/prototype/api/config.php	(revision 6357)
+++ sandbox/2.4.1-3/prototype/api/config.php	(revision 6367)
@@ -5,98 +5,118 @@
 class Config 
 {
-    static $register;
-    static $sessionStarted;
+	static $register;
+	static $sessionStarted;
   
-    static function module($config , $module = false)
-    {
-        //Todo: registrar na nova api o currentapp
-        if(!$module)
-            $module =  $_SESSION['flags']['currentapp'];
+	static function module($config , $module = false)
+	{
+		//Todo: registrar na nova api o currentapp
+		if(!$module)
+				$module =  $_SESSION['flags']['currentapp'];
   
-        if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] ))
-            $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true );
+		if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] ))
+				$_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true );
         
-        return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false;
+		return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false;
      
-    }
+	}
     
-    static function me($config)
-    {
+	static function me($config)
+	{
         
-        return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false;
-    }
+		return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false;
+	}
     
-    static function service( $service , $config )
-    {
-        if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] ))
-            $_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true );
+	static function service( $service , $config )
+	{
+		if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] ))
+				$_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true );
        
-        return (isset($_SESSION['wallet'][$service][$config])) ? $_SESSION['wallet'][$service][$config] : false;
-    }
+		return (isset($_SESSION['wallet'][$service][$config])) ? $_SESSION['wallet'][$service][$config] : false;
+	}
     
-    static function get( $concept , $config = false , $module = false )
-    {
-        $load = parse_ini_file( ROOTPATH."/config/$concept.ini", true );
+	static function get( $concept , $config = false , $module = false )
+	{
+		$load = parse_ini_file( ROOTPATH."/config/$concept.ini", true );
         
-        if($config === false) return $load;
+		if($config === false) return $load;
         
-        return (isset($load[$config])) ? $load[$config] : false;
-    }
+		return (isset($load[$config])) ? $load[$config] : false;
+	}
     
-    static function regSet( $name , $value)
-    {
-        self::$register[$name] = $value;
-    }
-    static function regGet ($name )
-    {
-        return (isset(self::$register[$name]) ? self::$register[$name] : false );
-    }
+	static function regSet( $name , $value)
+	{
+		self::$register[$name] = $value;
+	}
+	static function regGet ($name )
+	{
+		return (isset(self::$register[$name]) ? self::$register[$name] : false );
+	}
 
-    static function init( )
-    {
+	static function init( )
+	{
+    
+		if( !defined( 'ROOTPATH' ) )
+				define( 'ROOTPATH', dirname(__FILE__).'/..' );
         
-        if( !defined( 'ROOTPATH' ) )
-            define( 'ROOTPATH', dirname(__FILE__).'/..' );
-        
-        if ( isset( $_COOKIE[ 'sessionid' ] ) ) 
-        {
-            session_id( $_COOKIE[ 'sessionid' ] ); 
-            $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ];
-        }
+		if ( isset( $_COOKIE[ 'sessionid' ] ) ) 
+		{
+				session_id( $_COOKIE[ 'sessionid' ] ); 
+				$GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ];
+		}
 		
 	if( !self::$sessionStarted )
-            self::$sessionStarted = session_start();
-//		
-//	if( $header === true )
-//	{
-//            require_once (dirname(__FILE__).'/../../header.inc.php');
-//
-//            $_SESSION['wallet']['Sieve']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid'];
-//            $_SESSION['wallet']['Sieve']['password']      =  $GLOBALS['phpgw_info']['user']['passwd'];
-//
-//            $_SESSION['wallet']['Cyrus']['user']          =  $GLOBALS['phpgw_info']['user']['account_lid'];
-//            $_SESSION['wallet']['Cyrus']['password']      =  $GLOBALS['phpgw_info']['user']['passwd'];
-//
-//            $_SESSION['wallet']['user']['uid']	      	  =  $GLOBALS['phpgw_info']['user']['userid'];
-//            $_SESSION['wallet']['user']['uidNumber']      =  $GLOBALS['phpgw_info']['user']['account_id'];
-//            $_SESSION['wallet']['user']['password']       =  $GLOBALS['phpgw_info']['user']['passwd'];
-//            $_SESSION['wallet']['user']['cn']             =  $GLOBALS['phpgw_info']['user']['cn'];
-//            $_SESSION['wallet']['user']['mail']           =  $GLOBALS['phpgw_info']['user']['email'];
-//
-//            $_SESSION['wallet']['PostgreSQL']['user']     = $GLOBALS['phpgw_info']['server']['db_user'];
-//            $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass'];
-//            $_SESSION['wallet']['PostgreSQL']['dbname']   = $GLOBALS['phpgw_info']['server']['db_name'];
-//            $_SESSION['wallet']['PostgreSQL']['host']     = $GLOBALS['phpgw_info']['server']['db_host'];
-//            
-//            $_SESSION['wallet']['OpenLDAP']['context']   =  $GLOBALS['phpgw_info']['server']['ldap_context'];
-//            $_SESSION['wallet']['OpenLDAP']['host']      =  $GLOBALS['phpgw_info']['server']['ldap_host'];
-//           
-//	}
+				self::$sessionStarted = session_start();
 		
-    }
+	}
+    
+	public static function writeIniFile($assoc_arr, $path, $has_sections)
+	{
+		$content = '';
+
+		if (!$handle = fopen($path, 'w'))
+		{
+			trigger_error("Permission failure when trying to open the file: $path ", E_USER_WARNING);
+			return FALSE;
+		}	
+
+		self::_writeIniFile($content, $assoc_arr, $has_sections);
+
+		if (!fwrite($handle, $content))
+		{
+			trigger_error("Permission failure when trying to write in the file: $path ", E_USER_WARNING);
+		}	return FALSE;
+
+		fclose($handle);
+		return TRUE;
+	}
+
+	private static function _writeIniFile(&$content, $assoc_arr, $has_sections)
+	{
+		foreach ($assoc_arr as $key => $val)
+		{
+			if (is_array($val))
+			{
+				if($has_sections)
+				{
+					$content .= "[$key]\n";
+					self::_writeIniFile(&$content, $val, false);
+				}
+				else				
+					foreach($val as $iKey => $iVal)
+					{
+						if (is_int($iKey))
+							$content .= $key ."[] = $iVal\n";
+						else
+							$content .= $key ."[$iKey] = $iVal\n";
+					}
+			}
+			else
+				$content .= "$key = $val\n";
+		}
+	}
 
 }
 
-    Config::init();
+	Config::init();
 	
 
Index: sandbox/2.4.1-3/prototype/rest/dispatch.php
===================================================================
--- sandbox/2.4.1-3/prototype/rest/dispatch.php	(revision 6361)
+++ sandbox/2.4.1-3/prototype/rest/dispatch.php	(revision 6367)
@@ -37,6 +37,8 @@
 
 // handle request, passing the current env baseUri and autoload mapping;
+
+$restConf = parse_ini_file( __DIR__ . '/../config/REST.ini', true );
 $request = new Request(array(
-	'baseUri'=> '/gustavo/expressoDFD/rest',
+	'baseUri'=> $restConf['baseUri'],
 	'autoload' => $autoload,
 ));
