File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -244,12 +244,13 @@ export function createOAuthStateCookie(
244244 state : string ,
245245 isProduction : boolean ,
246246) : string {
247- // Use SameSite=Strict for OAuth state to prevent CSRF during OAuth flow
248- return `oauth_state=${ encodeURIComponent ( state ) } ; HttpOnly; Path=/; Max-Age=${ 10 * 60 } ; SameSite=Strict${ isProduction ? '; Secure' : '' } `
247+ // Use SameSite=Lax to allow the cookie to be sent on OAuth redirects back from providers
248+ // Strict would block the cookie since the redirect comes from an external domain (GitHub/Google)
249+ return `oauth_state=${ encodeURIComponent ( state ) } ; HttpOnly; Path=/; Max-Age=${ 10 * 60 } ; SameSite=Lax${ isProduction ? '; Secure' : '' } `
249250}
250251
251252export function clearOAuthStateCookie ( isProduction : boolean ) : string {
252- return `oauth_state=; HttpOnly; Path=/; Max-Age=0; SameSite=Strict ${ isProduction ? '; Secure' : '' } `
253+ return `oauth_state=; HttpOnly; Path=/; Max-Age=0; SameSite=Lax ${ isProduction ? '; Secure' : '' } `
253254}
254255
255256export function getOAuthStateCookie ( request : Request ) : string | null {
You can’t perform that action at this time.
0 commit comments