mirror of
https://github.com/elyby/accounts.git
synced 2024-08-26 14:29:57 +05:30
Set expires_in value for issue access token response
This commit is contained in:
parent
14661c2233
commit
274d56aa40
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user