Hello,
I’m trying to restrict a page to only logged-in users using the code below. However, even when I believe I’m logged in (based on the state
and code
present in the URL, and because I’m redirected to the after-login page), the isAuthenticated
method consistently returns false
.
I’ve enabled session_auto
in my php.ini
, but I suspect the issue may be related to sessions. When I check, I don’t see any active PHP sessions after logging in—only cookies. Can you advise on how I might debug this?
php
// Check if user is not authenticated
if (!$sdk->isAuthenticated()) {
// Redirect user to Auth0 login page
$loginUrl = $sdk->login();
header("Location: $loginUrl");
exit;
}
Thank you.