Przeglądaj źródła

UNA Market like on Boonex site: Store.

AntonLV 10 lat temu
rodzic
commit
44ede167e4
1 zmienionych plików z 12 dodań i 1 usunięć
  1. 12 1
      studio/classes/BxDolStudioOAuthOAuth2.php

+ 12 - 1
studio/classes/BxDolStudioOAuthOAuth2.php

@@ -117,14 +117,25 @@ class BxDolStudioOAuthOAuth2 extends BxDolStudioOAuth implements iBxDolSingleton
             'Authorization: Bearer ' . $this->oSession->getValue('sys_oauth_token'),
         ));
 
-        echo $sResponse; exit;		//--- Uncomment to debug
+        //echo $sResponse; exit;		//--- Uncomment to debug
         if (!$sResponse || ($aResponse = json_decode($sResponse, true)) === NULL || !$aResponse || isset($aResponse['error'])) {
+        	if($this->isReloginRequired($aResponse['error']))
+        		$this->unsetAuthorizedUser();
+
 			return isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_error occured');
         }
 
         return $aResponse;
     }
 
+    protected function isReloginRequired($sError)
+    {
+    	if(in_array($sError, array('expired_token')))
+    		return true;
+
+    	return false;
+    }
+
 	protected function _genCsrfToken($bReturn = false)
     {
         if (getParam('sys_security_form_token_enable') != 'on' || defined('BX_DOL_CRON_EXECUTE'))