Skip to content

Commit 65b0e3e

Browse files
fix(oauth): synchronize cookie and session duration with remember_me=true
- Pass remember_me=true to sign_in_identity and sign_up_identity - Pass rememberMe=true to getSessionCookieConfig - Add device_token to sign_up_identity call - Ensures cookie and DB session both use remember_me_duration (30 days) Fixes PR #1141 follow-up items #4 and #8: - #4: sign_up_identity now receives device_token - #8: Cookie and session duration now synchronized Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 65eec98 commit 65b0e3e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

graphql/server/src/middleware/oauth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export function createOAuthRoutes(opts: ConstructiveOptions): Router {
471471

472472
const signInSql = `
473473
SELECT * FROM "${privateSchema}".sign_in_identity(
474-
$1::text, $2::text, $3::jsonb, $4::text, 'access_token'::text, $5::text
474+
$1::text, $2::text, $3::jsonb, $4::text, 'access_token'::text, $5::text, $6::boolean
475475
)
476476
`;
477477

@@ -482,6 +482,7 @@ export function createOAuthRoutes(opts: ConstructiveOptions): Router {
482482
JSON.stringify(details),
483483
profile.email,
484484
deviceToken,
485+
true,
485486
]);
486487

487488
result = signInResult.rows[0] || {};
@@ -517,7 +518,7 @@ export function createOAuthRoutes(opts: ConstructiveOptions): Router {
517518
// Call sign_up_identity (using same client with JWT context)
518519
const signUpSql = `
519520
SELECT * FROM "${privateSchema}".sign_up_identity(
520-
$1::text, $2::text, $3::text, $4::jsonb, 'access_token'::text
521+
$1::text, $2::text, $3::text, $4::jsonb, 'access_token'::text, $5::text, $6::boolean
521522
)
522523
`;
523524

@@ -526,6 +527,8 @@ export function createOAuthRoutes(opts: ConstructiveOptions): Router {
526527
profile.providerId,
527528
profile.email,
528529
JSON.stringify(details),
530+
deviceToken,
531+
true,
529532
]);
530533

531534
result = signUpResult.rows[0] || {};
@@ -564,7 +567,7 @@ export function createOAuthRoutes(opts: ConstructiveOptions): Router {
564567
} else {
565568
// Same-origin: Cookie mode only
566569
// Set httpOnly cookies, no token in URL
567-
const sessionConfig = getSessionCookieConfig(authSettings);
570+
const sessionConfig = getSessionCookieConfig(authSettings, true);
568571
setSessionCookie(res, result.access_token, sessionConfig);
569572

570573
if (result.out_device_token) {

0 commit comments

Comments
 (0)