$_ENV['AUTH0_DOMAIN'], 'clientId' => $_ENV['AUTH0_CLIENT_ID'], 'clientSecret' => $_ENV['AUTH0_CLIENT_SECRET'], 'cookieSecret' => $_ENV['AUTH0_COOKIE_SECRET'] ]); } return self::$auth0; } /** * Initiate a log on with Auth0 * * @throws ConfigurationException If the Auth0 client is not configured correctly */ public static function logOn(): never { $params = match (true) { $_SERVER['PHP_SELF'] <> '/user/log-on.php' => ['redirectUri' => $_SERVER['PHP_SELF']], default => [] }; self::client()->clear(); header('Location: ' . self::client()->login($_ENV['AUTH0_BASE_URL'] . '/user/log-on/success', $params)); exit; } /** * Log off from this application and Auth0 * * @throws ConfigurationException If the Auth0 client is not configured correctly */ public static function logOff(): never { session_destroy(); header('Location: ' . self::client()->logout($_ENV['AUTH0_BASE_URL'])); exit; } }