So i want to redirect this exception like this, but it keeps throwing The exception message. Handling the exceptions in the Request middleware is diferent from the Authorization middleware?
Please show some code. We can’t possibly guess what you’ve tried.
I just tried to do what’s in the link above… something like this:
> $middlewareQueue->add(new AuthorizationMiddleware($this, [
'unauthorizedHandler' => [ 'className' => 'Authorization.Redirect', 'url' => Router::url(['controller' => 'Users', 'action' => 'home']), 'queryParam' => 'CakeRedirect', 'exceptions' => [ MissingIdentityException::class, ForbiddenException::class, ], ], ]));
Since it didn’t work. I did the same with
but i get the same response. It didn’t redirect my exception to my url.
Neverthless, it works when i make use of this:
in my controllers. The problem is with the Request Authorization Middleware.
did u found solution ?
Doesn’t work for me either. Using this example
Added the ForbiddenException to my list of exceptions but it keeps throwing the Exception instead of redirecting to the login page. Anyone got this to work?