3namespace Bitrix\Mail\Helper\OAuth;
13 $this->oauthEntity =
new LiveIdInterface;
15 $this->oauthEntity->addScope(
array(
32 'email' => $userData[
'emails'][
'account'],
33 'first_name' => $userData[
'first_name'],
34 'last_name' => $userData[
'last_name'],
35 'full_name' => $userData[
'name'],
36 'image' => sprintf(
'https://apis.live.net/v5.0/%s/picture?type=small', $userData[
'id']),
37 'error' => $userData[
'error'][
'message'],
48 return \CSocServLiveIdOAuth::CONTROLLER_URL;
53if (
Main\Loader::includeModule(
'socialservices'))
55 class_exists(
'CSocServLiveIdOAuth');
57 class LiveIdInterface
extends \CLiveIdOAuthInterface
60 public function setCode(
$code)
65 public function setToken($access_token)
67 $this->access_token = $access_token;
70 public function getStorageTokens()
75 public function getTokenData()
78 'access_token' => $this->access_token,
79 'refresh_token' => $this->refresh_token,
80 'expires_in' => Mail\Helper\OAuth::convertTokenExpiresToUnixtimeIfNeed($this->accessTokenExpires),
84 public function getCurrentUser()
86 if (empty($this->access_token))
91 $httpClient = new \Bitrix\Main\Web\HttpClient();
92 $httpClient->setHeader(
'Authorization',
'Bearer ' . $this->access_token);
94 $result = $httpClient->get(static::CONTACTS_URL);
102 catch (\Exception $e)
112 $this->getTokenData()
119 public function setAccessTokenExpires($expires): void
121 $this->accessTokenExpires = (int)$expires;
if(!Loader::includeModule('messageservice')) $provider
mapUserData(array $userData)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code