3namespace Bitrix\Rest\OAuth;
5use Bitrix\Main\SystemException;
6use Bitrix\Rest\AuthProviderInterface;
7use Bitrix\Rest\Event\Session;
8use Bitrix\Rest\OAuthService;
9use Bitrix\Main\Type\DateTime;
20 if(static::$instance ===
null)
22 static::$instance =
new static();
25 return static::$instance;
35 $codeInfo = $client->getCode(
$clientId, $state, $additionalParams);
37 if($codeInfo[
'result'])
39 return $codeInfo[
'result'];
57 $authResult = $client->getAuth(
$clientId, $scope, $additionalParams);
59 if($authResult[
'result'])
61 if($authResult[
'result'][
'access_token'])
63 $authResult[
'result'][
'user_id'] =
$userId;
64 $authResult[
'result'][
'client_id'] =
$clientId;
69 if (!empty($authResult[
'result'][
'date_finish_format']))
71 $dateFinish =
new DateTime($authResult[
'result'][
'date_finish_format'], DATE_ATOM);
72 $authResult[
'result'][
'date_finish'] = $dateFinish->getTimestamp();
75 return $authResult[
'result'];
104 if(!is_array($additionalParams))
106 $additionalParams =
array();
111 $additionalParams[Session::PARAM_SESSION] =
Session::get();
113 return $additionalParams;
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static storeRegisteredAuth(array $tokenInfo)
authorizeClient($clientId, $userId, $state='')
getTokenParams($additionalParams, $userId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)