Skip to content
Snippets Groups Projects
Commit dd1cbfb7 authored by vtigerosm's avatar vtigerosm
Browse files

Fix #526 google sync not working

Found two bugs:

1) That prevents from getting to token
2) One with WSAPP log
parents 8fa41dc9 69d840d6
No related branches found
No related tags found
No related merge requests found
......@@ -136,14 +136,6 @@ class Google_Oauth2_Connector {
header('Location: ' . $this->getAuthUrl());
}
protected function decryptAuthCode($cipherText) {
$publicKey = VtigerConfig::getOD('OAUTHREDIR_PUBK');
$pubkey_res = openssl_get_publickey($publicKey);
$base64Decoded = base64_decode($cipherText);
openssl_public_decrypt($base64Decoded,$decipheredText,$pubkey_res);
return $decipheredText;
}
protected function fireRequest($url,$headers,$params=array(),$method='POST') {
$httpClient = new Vtiger_Net_Client($url);
if(count($headers)) $httpClient->setHeaders($headers);
......@@ -246,7 +238,7 @@ class Google_Oauth2_Connector {
return $this;
} else {
if($_REQUEST['service'] && $_REQUEST['code']) {
$authCode = $this->decryptAuthCode($_REQUEST['code']);
$authCode = $_REQUEST['code'];
$token = $this->exchangeCodeForToken($authCode);
$this->storeToken($token);
echo '<script>window.opener.sync();window.close();</script>'; exit;
......
......@@ -16,6 +16,7 @@ require_once 'modules/WSAPP/synclib/connectors/VtigerConnector.php';
require_once 'include/database/PearDatabase.php';
require_once 'modules/WSAPP/api/ws/Register.php';
require_once 'modules/WSAPP/WSAPPLogs.php';
abstract class WSAPP_SynchronizeController {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment