Skip to content

Commit

Permalink
JWTs don't actually need a typ component.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Oct 16, 2023
1 parent 21c8d3a commit 51c84b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jwtparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function validate($s) {
if (!$this->has_alg($jose->alg ?? null)) {
$this->error_at(null, "<0>Unknown algorithm");
return null;
} else if (($jose->typ ?? null) !== "JWT") {
} else if (isset($jose->typ) && ($jose->typ ?? null) !== "JWT") {
$suffix = isset($jose->typ) && is_string($jose->typ) ? "{$jose->typ}" : "";
$this->error_at(null, "<0>Unexpected message type{$suffix}");
return null;
Expand Down

0 comments on commit 51c84b5

Please sign in to comment.