diff --git a/app/code/Magento/Integration/Helper/Oauth/Data.php b/app/code/Magento/Integration/Helper/Oauth/Data.php index d14bc0f9355a..93fab35c1f40 100644 --- a/app/code/Magento/Integration/Helper/Oauth/Data.php +++ b/app/code/Magento/Integration/Helper/Oauth/Data.php @@ -121,7 +121,7 @@ public function getConsumerPostTimeout() public function getCustomerTokenLifetime() { $hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/customer'); - return is_numeric($hours) ? $hours : 0; + return is_numeric($hours) && $hours > 0 ? $hours : 0; } /** @@ -132,6 +132,6 @@ public function getCustomerTokenLifetime() public function getAdminTokenLifetime() { $hours = $this->_scopeConfig->getValue('oauth/access_token_lifetime/admin'); - return is_numeric($hours) ? $hours : 0; + return is_numeric($hours) && $hours > 0 ? $hours : 0; } } diff --git a/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php b/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php index 5c54c8b8660d..8dcaabda93aa 100644 --- a/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php +++ b/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php @@ -137,7 +137,7 @@ private function isTokenExpired(Token $token): bool return false; } - if (strtotime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) { + if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) { return true; }