Skip to content

Commit 7f34b22

Browse files
krukasvijay-wagento
authored andcommitted
#15564 Generated admin API token expires immediately
When admin token lifetime setting is empty, the token will expire immediatly
1 parent 943e2cd commit 7f34b22

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ private function isTokenExpired(Token $token): bool
132132
// other user-type tokens are considered always valid
133133
return false;
134134
}
135+
136+
if (empty($tokenTtl)) {
137+
return false;
138+
}
139+
135140
if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
136141
return true;
137142
}

0 commit comments

Comments
 (0)