[PR #6619] [MERGED] fix: storeStateStrategy default to database if provided #32384

Closed
opened 2026-04-17 23:12:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6619
Author: @himself65
Created: 12/8/2025
Status: Merged
Merged: 12/8/2025
Merged by: @Bekacru

Base: canaryHead: himself65/2025/12/09/fix


📝 Commits (1)

  • 7aba98a fix: storeStateStrategy default to database if provided

📊 Changes

2 files changed (+5 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/context/create-context.ts (+3 -1)
📝 packages/better-auth/src/oauth2/state.ts (+2 -4)

📄 Description

Summary by cubic

Fixes inconsistent OAuth2 state storage defaults. If a database is configured, we now default to database storage; otherwise we use cookies, and both state generation and parsing use the same config.

  • Bug Fixes
    • Set oauthConfig.storeStateStrategy in createAuthContext to: explicit option > database (if configured) > cookie.
    • Removed internal fallbacks in generateState/parseState; both read the strategy from context to avoid mismatches.

Written for commit 7aba98a694. Summary will update automatically 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/6619 **Author:** [@himself65](https://github.com/himself65) **Created:** 12/8/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `himself65/2025/12/09/fix` --- ### 📝 Commits (1) - [`7aba98a`](https://github.com/better-auth/better-auth/commit/7aba98a6949ac22726b699e89f9544d231097e9f) fix: storeStateStrategy default to database if provided ### 📊 Changes **2 files changed** (+5 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/context/create-context.ts` (+3 -1) 📝 `packages/better-auth/src/oauth2/state.ts` (+2 -4) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes inconsistent OAuth2 state storage defaults. If a database is configured, we now default to database storage; otherwise we use cookies, and both state generation and parsing use the same config. - **Bug Fixes** - Set oauthConfig.storeStateStrategy in createAuthContext to: explicit option > database (if configured) > cookie. - Removed internal fallbacks in generateState/parseState; both read the strategy from context to avoid mismatches. <sup>Written for commit 7aba98a6949ac22726b699e89f9544d231097e9f. Summary will update automatically 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-17 23:12:46 -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#32384