Skip to content

Commit ab4fead

Browse files
authored
Merge pull request #2 from AnatolyRugalev/parse-exception-handling
Added parse exception handling
2 parents 0283eab + 222197f commit ab4fead

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Jwt.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ public function getValidationData($currentTime = null)
7373
*/
7474
public function loadToken($token, $validate = true, $verify = true)
7575
{
76-
$token = $this->getParser()->parse((string)$token);
76+
try {
77+
$token = $this->getParser()->parse((string)$token);
78+
} catch (\RuntimeException $e) {
79+
Yii::warning("Invalid JWT provided: " . $e->getMessage(), 'jwt');
80+
return null;
81+
}
7782

7883
if ($validate && !$this->validateToken($token)) {
7984
return null;

0 commit comments

Comments
 (0)