Files
adminandClaude Sonnet 5 17a17bd392 fix(mobile): add sso-callback route to fix Unmatched Route on Android Google login
Multiple users reported "Unmatched Route pawfeed://sso-callback" after
Google sign-in. Root cause: Android's custom tab delivers the OAuth
redirect intent to the app twice — once caught correctly by
expo-web-browser's openAuthSessionAsync() session, but also as a plain
deep link seen by expo-router's own Linking listener. With no matching
route, expo-router briefly showed its built-in Unmatched Route error
screen instead of letting the real sign-in flow (GoogleSignInButton ->
setActive -> router.replace) take over.

Adds app/sso-callback.tsx as a themed loading spinner so expo-router has
a valid screen for that window; no auth logic needed there since
useProtectedRoute() in app/_layout.tsx already redirects based on
Clerk's session state. JS-only change, OTA-deployable, no native rebuild
needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 17:24:35 +02:00

28 lines
1.3 KiB
TypeScript

import { View, ActivityIndicator } from "react-native";
import { useTheme } from "../src/context/ThemeContext";
/**
* On Android, the custom tab used by Clerk's useSSO() fires the OAuth
* redirect intent (pawfeed://sso-callback) at the app itself, not just at
* expo-web-browser's pending openAuthSessionAsync() promise — so
* expo-router's own Linking listener also sees the URL. Without a matching
* route here, that shows Expo Router's "Unmatched Route" error screen to
* the user for however long the real handshake (GoogleSignInButton's
* startSSOFlow -> setActive -> router.replace("/(app)")) takes to resolve
* and navigate away.
*
* This route exists purely to give expo-router something valid to render
* during that window. It deliberately does no auth-state logic itself —
* app/_layout.tsx's useProtectedRoute() already redirects signed-out users
* away from any non-(auth) screen, and GoogleSignInButton takes over
* navigation the moment the real SSO flow completes.
*/
export default function SsoCallback() {
const { colors } = useTheme();
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center", backgroundColor: colors.porchWhite }}>
<ActivityIndicator color={colors.marigoldOrange} />
</View>
);
}