'Undefined Auth0 dependencies
I have a Lumen application by following this tutorial ( Tutoorial Lumen )
I ran this command : composer require auth0/auth0-php
, it works without failure
And after that I put that in my Middleware ->
<?php
namespace App\Http\Middleware;
use Closure;
use Auth0\SDK\Exception\InvalidTokenException;
use Auth0\SDK\Helpers\JWKFetcher;
use Auth0\SDK\Helpers\Tokens\AsymmetricVerifier;
use Auth0\SDK\Helpers\Tokens\TokenVerifier;
But, when I have that part of the code :
public function validateToken($token)
{
try {
$jwksUri = env('AUTH0_DOMAIN') . '.well-known/jwks.json';
$jwksFetcher = new JWKFetcher(null, [ 'base_uri' => $jwksUri ]);
$signatureVerifier = new AsymmetricVerifier($jwksFetcher);
$tokenVerifier = new TokenVerifier(env('AUTH0_DOMAIN'), env('AUTH0_AUD'), $signatureVerifier);
$decoded = $tokenVerifier->verify($token);
}
catch(InvalidTokenException $e) {
throw $e;
};
}
I have error on every Auth0 things :
- Undefined type 'Auth0\SDK\Helpers\JWKFetcher'
- Undefined type 'Auth0\SDK\Helpers\Tokens\AsymmetricVerifier'
- Undefined type 'Auth0\SDK\Helpers\Tokens\TokenVerifier'
- Undefined type 'Auth0\SDK\Exception\InvalidTokenException'
Someone know why ? Thanks a lot in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|