File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
packages/backend/src/tokens Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export type SignedInState = {
27
27
afterSignInUrl : string ;
28
28
afterSignUpUrl : string ;
29
29
isSignedIn : true ;
30
- toAuth : ( opts ?: PendingSessionOptions ) => SignedInAuthObject ;
30
+ toAuth : ( opts ?: PendingSessionOptions ) => SignedInAuthObject | SignedOutAuthObject ;
31
31
headers : Headers ;
32
32
token : string ;
33
33
} ;
@@ -99,7 +99,6 @@ export function signedIn(
99
99
afterSignInUrl : authenticateContext . afterSignInUrl || '' ,
100
100
afterSignUpUrl : authenticateContext . afterSignUpUrl || '' ,
101
101
isSignedIn : true ,
102
- // @ts -expect-error The return type is intentionally overridden here to support consumer-facing logic that treats pending sessions as signed out. This override does not affect internal session management like handshake flows.
103
102
toAuth : ( { treatPendingAsSignedOut = true } = { } ) => {
104
103
if ( treatPendingAsSignedOut && authObject . sessionStatus === 'pending' ) {
105
104
return signedOutAuthObject ( undefined , authObject . sessionStatus ) ;
Original file line number Diff line number Diff line change @@ -463,13 +463,13 @@ export async function authenticateRequest(
463
463
authenticateContext . sessionTokenInCookie ! ,
464
464
) ;
465
465
466
+ const authObject = signedInRequestState . toAuth ( ) ;
466
467
// Org sync if necessary
467
- const handshakeRequestState = handleMaybeOrganizationSyncHandshake (
468
- authenticateContext ,
469
- signedInRequestState . toAuth ( ) ,
470
- ) ;
471
- if ( handshakeRequestState ) {
472
- return handshakeRequestState ;
468
+ if ( authObject . userId ) {
469
+ const handshakeRequestState = handleMaybeOrganizationSyncHandshake ( authenticateContext , authObject ) ;
470
+ if ( handshakeRequestState ) {
471
+ return handshakeRequestState ;
472
+ }
473
473
}
474
474
475
475
return signedInRequestState ;
You can’t perform that action at this time.
0 commit comments