Skip to content

feat: add setSessionCookie(event, token) server utility#299

Merged
onmax merged 2 commits intonuxt-modules:mainfrom
onmax:issue-296-set-session-cookie
Mar 26, 2026
Merged

feat: add setSessionCookie(event, token) server utility#299
onmax merged 2 commits intonuxt-modules:mainfrom
onmax:issue-296-set-session-cookie

Conversation

@onmax
Copy link
Copy Markdown
Collaborator

@onmax onmax commented Mar 25, 2026

Closes #296

Summary

  • add an auto-imported setSessionCookie(event, token) server helper
  • sign the Better Auth session token cookie with the configured secret
  • clear stale session cache cookies on the response
  • document the helper in the server utils and auto-import docs

Validation

  • pnpm vitest run test/get-request-session.test.ts
  • fresh /tmp/nuxt-better-auth-296-repro app: /api/me returns 401, /api/custom-login returns 200, then /api/me returns 200 with the cookie set by setSessionCookie

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

@onmax is attempting to deploy a commit to the maximogarciamartinez's projects Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@onmax/nuxt-better-auth@299

commit: 66ac2d1

@onmax onmax force-pushed the issue-296-set-session-cookie branch from 7281eaa to 5bca795 Compare March 26, 2026 06:06
@onmax onmax merged commit b17373d into nuxt-modules:main Mar 26, 2026
3 of 4 checks passed
@onmax onmax deleted the issue-296-set-session-cookie branch March 26, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add setSessionCookie(event, token) server utility

1 participant