Open prodigy7 opened 6 years ago
Second this. It's very annoying when there even isn't a list of possible exceptions.
if you want to handle the exceptions globally in handler.php
if ($exception instanceof UnauthorizedHttpException){
if(get_parent_class($exception) instanceof TokenExpiredException){
return JR::JWTTokenExpired();
}elseif (get_parent_class($exception) instanceof TokenBlacklistedException){
return JR::JWTTokenBlacklisted();
}else{
return JR::JWTTokenInvalid();
}
}
I am using
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"tymon/jwt-auth": "1.0.0-rc.1"
it worked here Add the following code to the render method within app/Exceptions/Handler.php
public function render($request, Exception $e)
{
if($e instanceof \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException){
return response()->json([$e->getMessage()], $e->getStatusCode());
}
return parent::render($request, $e);
}
I am using
"php": ">=7.0.0", "fideloper/proxy": "~3.3", "laravel/framework": "5.5.*", "laravel/tinker": "~1.0", "tymon/jwt-auth": "1.0.0-rc.1"
it worked here Add the following code to the render method within app/Exceptions/Handler.php
public function render($request, Exception $e) { if($e instanceof \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException){ return response()->json([$e->getMessage()], $e->getStatusCode()); } return parent::render($request, $e); }
This solved the issue for me
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
After some hours I get my installation now working with multiple guards and laravel 5.5. Finally https://github.com/tymondesigns/jwt-auth/blob/develop/docs/laravel-installation.md helped me implement it on a way, its working. Now I want implement custom exception handling but the documentation (https://github.com/tymondesigns/jwt-auth/blob/develop/docs/exception-handling.md) is currently empty. Is there anyone, can provide me with a small working sample for 1.0.0-rc.1?
Thx!