After/Before Callbacks never called?
theDyingMountain opened this issue · 3 comments
In my case the after/before callbacks are never called, even after successful authorization. The response body returns "bool(true)" all the time. What i'm doing wrong?
$app->add(new Tuupola\Middleware\HttpBasicAuthentication([ "realm" => "Protected", "authenticator" => new PdoAuthenticator([ "pdo" => $pdo, "table" => "accounts", "user" => "username", "hash" => "password" ]), "after" => function ($response, $arguments) { var_dump('tt'); exit(); return $response->withHeader("X-Brawndo", "plants crave"); }
Sorry my fault.
What did you do to resolve this? I am having the same issue where the after call back is not being triggered.
after" => function (Response $response, $arguments) use(&$container): Response {
var_dump("You entered this callback");
$session = $container->get('Session');
if (session_status() === PHP_SESSION_NONE){
//12 hours
$session->start([
'cookie_lifetime' => 43200,
'cookie_httponly' => true,
'cookie_secure' => true,
'cookie_samesite' => true,
'cookie_domain' => 'thenetnotebook.io'
]);
}
return $response;
}
Sorry it's been a while. I don't remember the cause of the problem. Good luck!