[PR #8084] [MERGED] feat: add /update-session #24634

Closed
opened 2026-04-15 22:29:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8084
Author: @himself65
Created: 2/20/2026
Status: Merged
Merged: 2/23/2026
Merged by: @himself65

Base: canaryHead: himself65/2026/02/21/session


📝 Commits (6)

📊 Changes

9 files changed (+370 additions, -1 deletions)

View changed files

📝 docs/content/docs/concepts/session-management.mdx (+26 -0)
📝 packages/better-auth/src/api/index.ts (+2 -0)
📝 packages/better-auth/src/api/routes/index.ts (+1 -0)
📝 packages/better-auth/src/api/routes/session-api.test.ts (+96 -0)
packages/better-auth/src/api/routes/update-session.ts (+99 -0)
📝 packages/better-auth/src/client/config.ts (+1 -0)
📝 packages/better-auth/src/db/schema.ts (+2 -1)
📝 packages/better-auth/src/plugins/open-api/__snapshots__/open-api.test.ts.snap (+139 -0)
📝 packages/better-auth/src/types/models.ts (+4 -0)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/8080


Summary by cubic

Add POST /update-session to update custom session fields on the current session and refresh the session cookie. Fixes client update signal so session state refetches after updates; fixes better-auth/better-auth#8080.

  • New Features
    • Adds updateSession endpoint and client.updateSession; only accepts additional fields and rejects core or input:false fields.
    • Refreshes the session cookie and returns the normalized session; passes action "update" to parseSessionInput, adds AdditionalSessionFieldsInput, and updates OpenAPI/docs/tests.

Written for commit 24d746d5b6. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8084 **Author:** [@himself65](https://github.com/himself65) **Created:** 2/20/2026 **Status:** ✅ Merged **Merged:** 2/23/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2026/02/21/session` --- ### 📝 Commits (6) - [`0e81168`](https://github.com/better-auth/better-auth/commit/0e81168020fba7e452e7880974701afc7cdfe79e) feat: add `/update-session` - [`776fb19`](https://github.com/better-auth/better-auth/commit/776fb19bd701a8dced01d1e83b92a7fdd37e737d) docs: update - [`bb00fe2`](https://github.com/better-auth/better-auth/commit/bb00fe2af0a0428a35095e048d1c25cafb70cc66) update - [`826fbd1`](https://github.com/better-auth/better-auth/commit/826fbd173ee822a91696c613eab83ab3dacd2d1b) fix: update signal - [`89fd75f`](https://github.com/better-auth/better-auth/commit/89fd75f3914886ed0d78baf1f003800dad3775db) fix: schema - [`24d746d`](https://github.com/better-auth/better-auth/commit/24d746d5b6acc3f727d5a318fc893a7792efef9a) Merge branch 'canary' into himself65/2026/02/21/session ### 📊 Changes **9 files changed** (+370 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/session-management.mdx` (+26 -0) 📝 `packages/better-auth/src/api/index.ts` (+2 -0) 📝 `packages/better-auth/src/api/routes/index.ts` (+1 -0) 📝 `packages/better-auth/src/api/routes/session-api.test.ts` (+96 -0) ➕ `packages/better-auth/src/api/routes/update-session.ts` (+99 -0) 📝 `packages/better-auth/src/client/config.ts` (+1 -0) 📝 `packages/better-auth/src/db/schema.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/open-api/__snapshots__/open-api.test.ts.snap` (+139 -0) 📝 `packages/better-auth/src/types/models.ts` (+4 -0) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/8080 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add POST /update-session to update custom session fields on the current session and refresh the session cookie. Fixes client update signal so session state refetches after updates; fixes better-auth/better-auth#8080. - **New Features** - Adds updateSession endpoint and client.updateSession; only accepts additional fields and rejects core or input:false fields. - Refreshes the session cookie and returns the normalized session; passes action "update" to parseSessionInput, adds AdditionalSessionFieldsInput, and updates OpenAPI/docs/tests. <sup>Written for commit 24d746d5b6acc3f727d5a318fc893a7792efef9a. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:29:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#24634