fix(auth): eliminate competing deleteCookie on login verify and ensure proper session persistence
This commit is contained in:
parent
3c57dfbc78
commit
cf42a32800
@ -821,11 +821,9 @@ app.post("/api/login/verify", async (c) => {
|
|||||||
|
|
||||||
const cookieDomain = getCookieDomain(rpID);
|
const cookieDomain = getCookieDomain(rpID);
|
||||||
|
|
||||||
// Clear any existing host-scoped cookie to prevent domain duplication
|
|
||||||
deleteCookie(c, "session_id", { path: "/" });
|
|
||||||
|
|
||||||
setCookie(c, "session_id", sessionId, {
|
setCookie(c, "session_id", sessionId, {
|
||||||
domain: cookieDomain,
|
domain: cookieDomain,
|
||||||
|
path: "/",
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: true,
|
secure: true,
|
||||||
sameSite: "Lax",
|
sameSite: "Lax",
|
||||||
|
|||||||
@ -159,7 +159,7 @@ export const AuthenticatedLayout = ({
|
|||||||
</style>
|
</style>
|
||||||
<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.umd.min.js">
|
<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.umd.min.js">
|
||||||
</script>
|
</script>
|
||||||
<script src="/public/auth-client.js?v=2"></script>
|
<script src="/public/auth-client.js?v=3"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="header">
|
<header class="header">
|
||||||
|
|||||||
@ -95,7 +95,7 @@ export const LoginPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/public/auth-client.js?v=2"></script>
|
<script src="/public/auth-client.js?v=3"></script>
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
|
|||||||
@ -119,7 +119,7 @@ export const RegisterPage = (
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/public/auth-client.js?v=2"></script>
|
<script src="/public/auth-client.js?v=3"></script>
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
|
|||||||
@ -248,6 +248,10 @@ async function startWebAuthnLogin(username) {
|
|||||||
setStatus(verificationJSON.error || "Login verification failed", true);
|
setStatus(verificationJSON.error || "Login verification failed", true);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error("[WebAuthn Login]", err);
|
||||||
|
setStatus(
|
||||||
|
err.message || "An unexpected error occurred during authentication",
|
||||||
|
true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user