okta / okta-jwt-verifier-php

A helper library for working with JWT's for Okta
37 stars 70 forks source link

UnexpectedValueException: "kid" invalid, unable to lookup correct key #84

Open walterecook opened 3 years ago

walterecook commented 3 years ago

I have the Angular sample login. Pass that id_token into PHP. PHP has the required libraries, calls the autoload.php properly.

$jwtVerifier = ( new \Okta\JwtVerifier\JwtVerifierBuilder() ) ->setAdaptor( new \Okta\JwtVerifier\Adaptors\FirebasePhpJwt() ) ->setClientId( '{myClientID}' ) ->setAudience('api://default') ->setIssuer( 'https://myCompany.okta.com/oauth2/default' ) ->build();

$token = $jwtVerifier->verifyIdToken($jwt);

Yields this: UnexpectedValueException: "kid" invalid, unable to lookup correct key in /vendor/firebase/php-jwt/src/JWT.php:117

I've followed several different protocols, they look simple enough and I keep coming back to this.

bryanapellanes-okta commented 3 years ago

@walterecook, Thanks for reaching out! Please accept our apologies for the delayed response. Our PHP developers will review and respond with more.

GuillaumeRossolini commented 3 years ago

Hi,

When I ran into this issue, was because of a mismatch with the issuer. It was set to one thing in the /authorize and /token calls, but something else in the verify() call.

Hope it helps.