OKTA JWTVerifier FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED PHP deprecation errors

Hi, new here.

I’m using Okta to manager the log in and authorization of users within a PHP application.

I’ve used the Sign in Widget for login and on the page that handles the redirect from okta, I have added code based on the php sample provided by the Okta documentation.

When trying to verify the access / id token with the Authorization server using the Okta Jwt Verifier, an exception occurs due to deprecation errors and the tokens can not be verified.

This is the code that handles the verification:

$jwtVerifier = (new \Okta\JwtVerifier\JwtVerifierBuilder())
->setIssuer(env(‘OKTA_OATH_ISSUER’))
->setAudience(‘api://default’)
->setClientId(env(‘OKTA_CLIENT_ID’))
->build();
return $jwtVerifier->verify($jwt);

The call to the verify method throws this exception:
ErrorException {
message: “filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated”
file: “/var/www/html/vendor/spomky-labs/jose/src/Object/DownloadedJWKSet.php”
line: 65
}

Does anyone know how I can get around this?

I have resolved this issue by using the firebase php jwt adaptor instead.

$jwtVerifier = (new \Okta\JwtVerifier\JwtVerifierBuilder())
->setIssuer(env(‘OKTA_OATH_ISSUER’))
->setAudience(‘api://default’)
->setClientId(env(‘OKTA_CLIENT_ID’))
->setAdaptor( new \Okta\JwtVerifier\Adaptors\FirebasePhpJwt() )
->build();

Details here: https://github.com/okta/okta-jwt-verifier-php