1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
token.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Sale\Exchange\Integration\Entity;
5
6
7use Bitrix\Main\Type\DateTime;
8use Bitrix\Sale\Exchange\Integration\OAuth;
9
11{
12 public function refresh(OAuth\Client $oauthClient)
13 {
14 $response = $oauthClient->getAccessToken(
15 "refresh_token",
16 ["refresh_token" => $this->getRefreshToken()]
17 );
18
19 if (!isset($response["error"]) && is_array($response))
20 {
21 $this->update($response);
22 return true;
23 }
24
25 return false;
26 }
27
35 public function update(array $fields = [])
36 {
37 if (isset($fields["guid"]) && $fields["guid"] <> '')
38 {
39 $this->setGuid($fields["guid"]);
40 }
41
42 if (isset($fields["access_token"]))
43 {
44 $this->setAccessToken($fields["access_token"]);
45 }
46
47 if (isset($fields["refresh_token"]))
48 {
49 $this->setRefreshToken($fields["refresh_token"]);
50 }
51
52 if (isset($fields["client_endpoint"]))
53 {
54 $this->setRestEndpoint($fields["client_endpoint"]);
55 }
56
57 if (isset($fields["member_id"]))
58 {
59 $this->setPortalId($fields["member_id"]);
60 }
61
62 if (isset($fields["expires_in"]) && intval($fields["expires_in"]) > 0)
63 {
64 $this->setExpires((new DateTime())->add(intval($fields["expires_in"])." seconds"));
65 }
66
67 $this->setChanged(new DateTime());
68
69 return $this->save();
70 }
71}
refresh(OAuth\Client $oauthClient)
Определения token.php:12
update(array $fields=[])
Определения token.php:35
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$response
Определения result.php:21
$fields
Определения yandex_run.php:501