Skip to content

Commit eab3674

Browse files
committed
[BUGFIX] #15564 Generated admin API token expires immediately
When admin token lifetime setting is empty, the token will expire immediatly
1 parent 323994f commit eab3674

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
@@ -133,6 +133,11 @@ private function isTokenExpired(Token $token): bool
133133
// other user-type tokens are considered always valid
134134
return false;
135135
}
136+
137+
if (empty($tokenTtl)) {
138+
return false;
139+
}
140+
136141
if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) {
137142
return true;
138143
}

0 commit comments

Comments
 (0)