/
githubmirror
/
ydb-php-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-php-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Auth/Implement/OAuthTokenAuthentication.php
32 строки
742 B
Илья
Create private refresh ratio token parametr
22 авг 2023, 12:02
22 авг 2023, 12:02
5159a4d
Код
Авторство
О чём код?
<?php namespace YdbPlatform\Ydb\Auth\Implement; use YdbPlatform\Ydb\Auth\TokenInfo; class OAuthTokenAuthentication extends \YdbPlatform\Ydb\Auth\IamAuth { /** * @var string */ protected $oauth_token; public function __construct(string $oauth_token) { $this->oauth_token = $oauth_token; } public function getTokenInfo(): TokenInfo { $request_data = [ 'yandexPassportOauthToken' => $this->oauth_token, ]; $token = $this->requestToken($request_data); return new TokenInfo($token->iamToken, $this->convertExpiresAt($token->expiresAt), $this->refreshTokenRatio); } public function getName(): string { return 'OAuth token'; } }