Skip to content

Commit a03570b

Browse files
committed
Trigger org sync for pending sessions
1 parent 1ba65d2 commit a03570b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/backend/src/tokens/request.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,13 +590,14 @@ export const authenticateRequest: AuthenticateRequest = (async (
590590
);
591591
}
592592

593-
const authObject = signedInRequestState.toAuth();
594-
// Org sync if necessary
595-
if (authObject.userId) {
596-
const handshakeRequestState = handleMaybeOrganizationSyncHandshake(authenticateContext, authObject);
597-
if (handshakeRequestState) {
598-
return handshakeRequestState;
599-
}
593+
const authObject = signedInRequestState.toAuth({
594+
// The organization sync handshake will handle the pending session case, so we don't need to treat it as signed out here
595+
treatPendingAsSignedOut: false,
596+
});
597+
598+
const handshakeRequestState = handleMaybeOrganizationSyncHandshake(authenticateContext, authObject);
599+
if (handshakeRequestState) {
600+
return handshakeRequestState;
600601
}
601602

602603
return signedInRequestState;

0 commit comments

Comments
 (0)