diff --git a/lib/Service/DiscoveryService.php b/lib/Service/DiscoveryService.php index 5aa3b62c..3d1344ae 100644 --- a/lib/Service/DiscoveryService.php +++ b/lib/Service/DiscoveryService.php @@ -156,6 +156,12 @@ private function fixJwksAlg(array $jwks, string $jwt): array { } foreach ($jwks['keys'] as $index => $key) { + // php-jwt fails in JWK::parseKeySet the keyset contains one key with P-521 curve + // see https://github.com/firebase/php-jwt/blob/main/src/JWK.php#L31 + if (isset($key['crv']) && $key['crv'] === 'P-521') { + unset($jwks['keys'][$index]); + } + // Only fix the key being referred to in the JWT. if ($jwtHeader['kid'] != $key['kid']) { continue;