mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-01 20:06:41 -05:00
fix: storeStateStrategy default to database if provided (#6619)
This commit is contained in:
committed by
github-actions[bot]
parent
2b058b0537
commit
49c6bb2e1f
@@ -170,7 +170,9 @@ export async function createAuthContext(
|
||||
socialProviders: providers,
|
||||
options,
|
||||
oauthConfig: {
|
||||
storeStateStrategy: options.account?.storeStateStrategy || "database",
|
||||
storeStateStrategy:
|
||||
options.account?.storeStateStrategy ||
|
||||
(options.database ? "database" : "cookie"),
|
||||
skipStateCookieCheck: !!options.account?.skipStateCookieCheck,
|
||||
},
|
||||
tables,
|
||||
|
||||
@@ -27,8 +27,7 @@ export async function generateState(
|
||||
|
||||
const codeVerifier = generateRandomString(128);
|
||||
const state = generateRandomString(32);
|
||||
const storeStateStrategy =
|
||||
c.context.oauthConfig?.storeStateStrategy || "cookie";
|
||||
const storeStateStrategy = c.context.oauthConfig.storeStateStrategy;
|
||||
|
||||
const stateData = {
|
||||
...(additionalData ? additionalData : {}),
|
||||
@@ -99,8 +98,7 @@ export async function generateState(
|
||||
|
||||
export async function parseState(c: GenericEndpointContext) {
|
||||
const state = c.query.state || c.body.state;
|
||||
const storeStateStrategy =
|
||||
c.context.oauthConfig.storeStateStrategy || "cookie";
|
||||
const storeStateStrategy = c.context.oauthConfig.storeStateStrategy;
|
||||
|
||||
const stateDataSchema = z.looseObject({
|
||||
callbackURL: z.string(),
|
||||
|
||||
Reference in New Issue
Block a user