Skip to content

Commit

Permalink
fix: bad firebase call (#2245)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Apr 18, 2022
1 parent cb5250c commit 506c488
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/AccessToken/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

use Firebase\JWT\ExpiredException as ExpiredExceptionV3;
use Firebase\JWT\SignatureInvalidException;
use Firebase\JWT\Key;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use InvalidArgumentException;
Expand Down Expand Up @@ -99,11 +100,15 @@ public function verifyIdToken($idToken, $audience = null)
$certs = $this->getFederatedSignOnCerts();
foreach ($certs as $cert) {
try {
$payload = $this->jwt->decode(
$idToken,
$this->getPublicKey($cert),
array('RS256')
);
$args = [$idToken];
$publicKey = $this->getPublicKey($cert);
if (class_exists(Key::class)) {
$args[] = new Key($publicKey, 'RS256');
} else {
$args[] = $publicKey;
$args[] = ['RS256'];
}
$payload = \call_user_func_array([$this->jwt, 'decode'], $args);

if (property_exists($payload, 'aud')) {
if ($audience && $payload->aud != $audience) {
Expand Down

0 comments on commit 506c488

Please sign in to comment.