Auth0 Home Blog Docs

PHP error log 'Auth0\\SDK\\JWTVerifier not found

jwt
auth0
tier1
php
composer

#1

PHP Fatal error: Class ‘Auth0\SDK\JWTVerifier’ not found.

I have installed composer and ran this: composer require auth0/auth0-php:"~4.0"

At the top, I have imported this: use Auth0\SDK\JWTVerifier;

Where do I get this library from? How exactly do I install that SDK?

Thanks!


#2

UPDATE:

I removed auth0-php: 4.0 and installed the following:

“require”: {
“firebase/php-jwt”: “^4.0”,
“bramus/router”: “dev-master”,
“auth0/auth0-php”: “~5.0”
}

This still DOES NOT resolve the issue.

My php still errors out when going to create the new JWTVerifier. It says it cannot find the class.

I noticed that composer created a vendor directory and that there is a bunch of library files in there. Any ideas why this isn’t working???


#3

When you use composer to install auth0 you should find all of the auth0 files in vendor/auth0/auth0-php/src. My JWTVerifier is in that directory. I never need to call JWTVerifier itself though. What you should use is:

require  __DIR__ . '/vendor/autoload.php';

require  __DIR__ . '/dotenv-loader.php';

use Auth0\SDK\API\Authentication;

This should work, barring you have included the .env file in your source.


#4