Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
tokenclient.php
1<?php
3
4
6
7class TokenClient extends Base
8{
10 protected $token;
11
12 public function __construct(Integration\Entity\Token $token)
13 {
14 parent::__construct([
15 "accessToken" => $token->getAccessToken(),
16 "refreshToken" => $token->getRefreshToken(),
17 "endPoint" => $token->getRestEndpoint(),
18 ]);
19
20 $this->token = $token;
21 }
22
23 protected function refreshAccessToken()
24 {
25 $success = $this->token->refresh(new Integration\OAuth\Bitrix24());
26 if ($success)
27 {
28 $this->setAccessToken($this->token->getAccessToken());
29 $this->setRefreshToken($this->token->getRefreshToken());
30 $this->setEndPoint($this->token->getRestEndpoint());
31 }
32
33 return $success;
34 }
35}