Open andreclicksul opened 9 months ago
Try it like this:
return new JwtAuthentication([
"secure" => true,
"relaxed" => ["localhost"],
"path" => ["/admin"],
"cookie" => "tkn",
"secret" => getenv('JWT_SECRET'),
"error" => function ($response, $arguments) {
// create request to route
$requestFactory = new DecoratedServerRequestFactory(new ServerRequestFactory());
$newRequest = $requestFactory->createServerRequest('GET', '/login/301');
// internal redirect: needs $app in context
return $app->handle($newRequest)->withStatus(301);
}
]);
You would need to pass App $app
to the jwtAuth()
method.
Hello, forgive my English... I'm using slim 4 and raintpl, authenticating through cookies. Route authentication is perfect. My problem is when authentication fails, I need to redirect to the login route and I don't see how. I tried putting a "header("Location: /login/301")", but it didn't work.
Could you help me, please?