Closed arthurl31 closed 3 years ago
I create the jwt auth config
function jwtAuth(): JwtAuthentication { return new JwtAuthentication([ 'secure' => false, 'ignore' => ['/token'], 'secret' => env('JWT_SECRET') ]); }
then in my controller if i try to: $request->getAttribute('token');
$request->getAttribute('token');
It returns NULL, but if i remove the "ignore" from the JWT configuration it returns the decoded token just fine
return new JwtAuthentication([ 'secure' => false, 'secret' => env('JWT_SECRET') ]);
Does anyone knows what is happening?
As the name implies the middleware is not executed in the ignored routes. Since the middleware was not executed it did not write the token attribute to the $request object.
token
$request
I create the jwt auth config
then in my controller if i try to:
$request->getAttribute('token');
It returns NULL, but if i remove the "ignore" from the JWT configuration it returns the decoded token just fine
Does anyone knows what is happening?