Index: sandbox/2.4.1-3/rest/setup/default_records.inc.php
===================================================================
--- sandbox/2.4.1-3/rest/setup/default_records.inc.php	(revision 6368)
+++ sandbox/2.4.1-3/rest/setup/default_records.inc.php	(revision 6368)
@@ -0,0 +1,33 @@
+<?php
+
+$secret = substr(md5(rand().rand()), 0, 16); //Gera senha aleatoria
+
+$oProc->query("INSERT INTO rest_client (client_id, client_secret) values (1, '$secret');");
+$dados = array();
+$oProc->query("select * from phpgw_config where config_app='phpgwapi'");
+while ($oProc->next_record())
+{
+    $test = @unserialize($oProc->f('config_value'));
+    if($test)
+        $dados[$oProc->f('config_name')] = $test;
+    else
+        $dados[$oProc->f('config_name')] = $oProc->f('config_value');
+}
+
+/*
+Cria e configura o arquivo REST.ini 
+*/
+require_once dirname(__FILE__) . '/../../prototype/api/config.php';
+
+use prototype\api\Config as Config;
+
+$config = array();
+$config['baseUri'] = $dados['webserver_url'].'/rest';
+$config['oauth']['url_token'] = 'http://' . $_SERVER['HTTP_HOST'] . $dados['webserver_url'].'/rest/token';
+$config['oauth']['client_id'] = 1;
+$config['oauth']['client_secret'] = $secret;
+
+Config::writeIniFile($config , dirname(__FILE__) . '/../../prototype/config/REST.ini', true);
+    
+
+?>
Index: sandbox/2.4.1-3/rest/setup/tables_current.inc.php
===================================================================
--- sandbox/2.4.1-3/rest/setup/tables_current.inc.php	(revision 6368)
+++ sandbox/2.4.1-3/rest/setup/tables_current.inc.php	(revision 6368)
@@ -0,0 +1,77 @@
+<?php
+  /**************************************************************************\
+  * eGroupWare                                                               *
+  * http://www.egroupware.org                                                *
+  * --------------------------------------------                             *
+  *  This program is free software; you can redistribute it and/or modify it *
+  *  under the terms of the GNU General Public License as published by the   *
+  *  Free Software Foundation; either version 2 of the License, or (at your  *
+  *  option) any later version.                                              *
+  \**************************************************************************/
+
+
+	$phpgw_baseline = array(
+		
+		'rest_access_token' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto','nullable' => False),
+				'oauth_token' => array('type' => 'varchar','precision' => '40', 'nullable' => false),
+				'client_id' => array('type' => 'varchar', 'precision' => '40','nullable' => false),
+				'user_id' => array('type' => 'int', 'precision' => '16','nullable' => false),
+				'expires' => array('type' => 'int', 'varchar' => '8','nullable' => false),
+				'scope' => array('type' => 'varchar', 'varchar' => '255','nullable' => True),
+				'refresh_token' => array('type' => 'varchar', 'precision' => '40','nullable' => false)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+		
+		'rest_auth_code' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto','nullable' => False),
+				'redirect_uri' => array('type' => 'varchar','precision' => '255', 'nullable' => true),
+				'client_id' => array('type' => 'varchar', 'precision' => '40','nullable' => false),
+				'user_id' => array('type' => 'int', 'precision' => '16','nullable' => false),
+				'expires' => array('type' => 'int', 'varchar' => '8','nullable' => false),
+				'scope' => array('type' => 'varchar', 'varchar' => '255','nullable' => True),
+				'refresh_token' => array('type' => 'varchar', 'precision' => '40','nullable' => false)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+	
+		'rest_client' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto','nullable' => False),
+				'redirect_uri' => array('type' => 'varchar','precision' => '255', 'nullable' => true),
+				'client_id' => array('type' => 'varchar', 'precision' => '40','nullable' => false),
+				'client_secret' => array('type' => 'varchar', 'precision' => '40','nullable' => false)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+
+		'rest_refresh_token' => array(
+			'fd' => array(
+				'id' => array('type' => 'auto','nullable' => False),
+				'refresh_token' => array('type' => 'varchar','precision' => '40', 'nullable' => false),
+				'client_id' => array('type' => 'varchar', 'precision' => '40','nullable' => false),
+				'user_id' => array('type' => 'int', 'precision' => '16','nullable' => false),
+				'expires' => array('type' => 'int', 'varchar' => '8','nullable' => false),
+				'scope' => array('type' => 'varchar', 'varchar' => '255','nullable' => True),
+				'refresh_token' => array('type' => 'varchar', 'precision' => '40','nullable' => false)
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+		),
+
+	);
+?>
Index: sandbox/2.4.1-3/rest/setup/tables_update.inc.php
===================================================================
--- sandbox/2.4.1-3/rest/setup/tables_update.inc.php	(revision 6368)
+++ sandbox/2.4.1-3/rest/setup/tables_update.inc.php	(revision 6368)
@@ -0,0 +1,14 @@
+<?php
+	/**************************************************************************\
+	* ExpressoLivre - Setup                                                     *
+	* http://www.expressolivre.org                                              *
+	* --------------------------------------------                             *
+	* This program is free software; you can redistribute it and/or modify it  *
+	* under the terms of the GNU General Public License as published by the    *
+	* Free Software Foundation; either version 2 of the License, or (at your   *
+	* option) any later version.                                               *
+	\**************************************************************************/
+
+	
+        
+?>
Index: sandbox/2.4.1-3/rest/setup/setup.inc.php
===================================================================
--- sandbox/2.4.1-3/rest/setup/setup.inc.php	(revision 6368)
+++ sandbox/2.4.1-3/rest/setup/setup.inc.php	(revision 6368)
@@ -0,0 +1,34 @@
+<?php
+	/***********************************************************************************\
+	* Expresso REST API                										   
+	* 
+	* ---------------------------------------------------------------------------------*
+	*  This program is free software; you can redistribute it and/or modify it		   *
+	*  under the terms of the GNU General Public License as published by the		   *
+	*  Free Software Foundation; either version 2 of the License, or (at your		   *
+	*  option) any later version.													   *
+	\***********************************************************************************/
+
+	$setup_info['rest']['name']      	= 'rest';
+	$setup_info['rest']['title']     	= 'REST API' ;
+	/* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/
+	$setup_info['rest']['version']   	= '1.000';
+	$setup_info['rest']['app_order']	= 9;
+
+	$setup_info['rest']['tables'][]		=  'rest_access_token';
+	$setup_info['rest']['tables'][]		=  'rest_auth_code';
+	$setup_info['rest']['tables'][]		=  'rest_client';
+	$setup_info['rest']['tables'][]		=  'rest_refresh_token';
+
+
+	$setup_info['rest']['enable']		= 1;
+
+	$setup_info['rest']['author'] = 'autor';
+	$setup_info['rest']['maintainer'] = 'mantedor';
+
+	$setup_info['rest']['license']  = 'GPL';
+	$setup_info['rest']['description'] = 'Modulo de Suport a REST ExpressoLivre';
+
+    
+    
+?>
Index: sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini
===================================================================
--- sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini	(revision 6367)
+++ sandbox/2.4.1-3/prototype/config/oauthRefreshToken.ini	(revision 6368)
@@ -8,3 +8,3 @@
 expires = expires
 scope = scope
-refresh_token = refresh_tokenr
+refresh_token = refresh_token
