Skip to content

Commit

Permalink
Update firebase/php-jwt package
Browse files Browse the repository at this point in the history
  • Loading branch information
vokomarov committed Mar 11, 2023
1 parent 342f441 commit 73cf3f2
Show file tree
Hide file tree
Showing 3 changed files with 687 additions and 531 deletions.
4 changes: 2 additions & 2 deletions app/src/Auth/Jwt/TokenStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Config\JwtConfig;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use Spiral\Auth\Exception\TokenStorageException;
use Spiral\Auth\TokenInterface;
use Spiral\Auth\TokenStorageInterface;
Expand Down Expand Up @@ -52,7 +53,7 @@ public function load(string $id): ?TokenInterface
// TODO. Validate token for the blacklisted

try {
$payload = JWT::decode($id, $this->getVerifyKey(), [$this->alg]);
$payload = JWT::decode($id, new Key($this->getVerifyKey(), $this->alg));
return Token::fromPayload($id, (array) $payload);
} catch (\Throwable $exception) {
return null;
Expand Down Expand Up @@ -83,7 +84,6 @@ public function create(array $payload, \DateTimeInterface $expiresAt = null): To
'jti' => sha1((string) microtime(true)),
]);


$jwt = JWT::encode($payload, $this->getSigningKey(), $this->alg);

return new Token($jwt, $payload, $expiresAt);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cycle/entity-behavior": "^1.1",
"cycle/entity-behavior-uuid": "^1.0",
"doctrine/collections": "^1.6",
"firebase/php-jwt": "^5.2",
"firebase/php-jwt": "^6.0",
"illuminate/collections": "^9.8",
"kreait/firebase-php": "^5.0",
"laminas/laminas-diactoros": "^2.6",
Expand Down
Loading

0 comments on commit 73cf3f2

Please sign in to comment.