Class Firebase\Jwt\Jwt Not Found

Class Firebase\JWT\JWT not found

As per the documentation, you need to include the autoloader.

E.g., in your php file:

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

But... typically your vendor folder would be at the same level than your html folder (the one where you are serving content).

E.g.:

- Project root
--- vendor
--- html
----- index.php

Then in your index.php you'd do:

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

It is nice that you trying to use composer and modules, but if I were you I'd try to read on a bit about php's autoloading features, so you understand what's going on, and how you can profit from them.

Class 'JWT' not found

Yup my code is now working when I add

use \Firebase\JWT\JWT

in my user.php file instead of the index.php.

Thanks @jumper85 for your answer.

Error : Class 'Firebase\JWT\SignatureInvalidException' not found

I think you have to require_once signature before JWT.php

file will be something like this in codeigniter libraries.

class SignatureInvalidException extends \UnexpectedValueException
{
}

Error when creating token with JWT

If you copied the file from GitHub rather than using composer to install it, you will need to comment out the namespace lines at the top of the file. so from my snapshot at the very top of the first line of jwt.php screenshot, you will comment out //namespace Firebase\JWT; and you would not get the 500 internal server error again.



Related Topics



Leave a reply



Submit