Skip to content

Commit 137f430

Browse files
committed
fix(expo): clear native session when JS auth signs out
Call ClerkExpo.signOut() in NativeSessionSync when isSignedIn becomes false so native components don't retain a stale session after JS-side sign out.
1 parent c87fe1d commit 137f430

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/expo/src/provider/ClerkProvider.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ function NativeSessionSync({
7878
useEffect(() => {
7979
if (!isSignedIn) {
8080
hasSyncedRef.current = false;
81+
82+
// Clear the native session so native components (UserButton, etc.)
83+
// don't continue showing a signed-in state after JS-side sign out.
84+
const ClerkExpo = NativeClerkModule;
85+
if (ClerkExpo?.signOut) {
86+
void ClerkExpo.signOut().catch((error: unknown) => {
87+
if (__DEV__) {
88+
console.warn('[NativeSessionSync] Failed to clear native session:', error);
89+
}
90+
});
91+
}
92+
8193
return;
8294
}
8395

0 commit comments

Comments
 (0)