mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Формируем время в DateTime для генерации JWT токенов
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace api\components\User;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Yii;
|
||||
use yii\web\IdentityInterface;
|
||||
|
||||
@@ -33,9 +35,12 @@ class RenewResult {
|
||||
/** @var Component $component */
|
||||
$component = Yii::$app->user;
|
||||
|
||||
$now = new DateTime();
|
||||
$expiresIn = (clone $now)->add(new DateInterval($component->expirationTimeout));
|
||||
|
||||
return [
|
||||
'access_token' => $this->getJwt(),
|
||||
'expires_in' => $component->expirationTimeout,
|
||||
'expires_in' => $expiresIn->getTimestamp() - $now->getTimestamp(),
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user