Set expires_in value for issue access token response

This commit is contained in:
ErickSkrauch 2019-12-11 19:44:55 +03:00
parent 14661c2233
commit 274d56aa40

View File

@ -175,6 +175,14 @@ class OauthProcess {
$result['refresh_token'] = $result['access_token'];
}
if (($result['expires_in'] ?? 0) <= 0) {
// Since some of our clients use this field to understand how long the token will live,
// we have to give it some value. The tokens with zero lifetime don't expire
// but in order not to break the clients storing the value as integer on 32-bit systems,
// let's calculate the value based on the unsigned maximum for this type
$result['expires_in'] = 2 ** 31 - time();
}
Yii::$app->statsd->inc("oauth.issueToken_client.{$clientId}");
Yii::$app->statsd->inc("oauth.issueToken_{$grantType}.success");
} catch (OAuthServerException $e) {