Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/friendly-beers-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cipherstash/nextjs": minor
---

Cleared session cookies when a user has logged out.
12 changes: 11 additions & 1 deletion packages/nextjs/src/clerk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ export const jseqlClerkMiddleware = async (
path: '/',
})

const cookie = response.cookies.get(CS_COOKIE_NAME)
response.cookies.get(CS_COOKIE_NAME)
return response
}

if (!userId && ctsSession) {
logger.debug(
'No Clerk token found in the request, so the CipherStash session was reset.',
)

const response = NextResponse.next()
response.cookies.delete(CS_COOKIE_NAME)
return response
}

Expand Down