diff --git a/.changeset/expo-use-oauth-missing-redirect-url.md b/.changeset/expo-use-oauth-missing-redirect-url.md new file mode 100644 index 00000000000..2d2940a5191 --- /dev/null +++ b/.changeset/expo-use-oauth-missing-redirect-url.md @@ -0,0 +1,5 @@ +--- +'@clerk/expo': patch +--- + +Fix the deprecated `useOAuth()` hook crashing when the sign-in attempt has no external verification redirect URL. It now throws a Clerk error, matching `useSSO()`. diff --git a/packages/expo/src/hooks/useOAuth.ts b/packages/expo/src/hooks/useOAuth.ts index c3765f6299b..a1500e7a685 100644 --- a/packages/expo/src/hooks/useOAuth.ts +++ b/packages/expo/src/hooks/useOAuth.ts @@ -76,9 +76,11 @@ export function useOAuth(useOAuthParams: UseOAuthFlowParams) { await signIn.create({ strategy, redirectUrl: oauthRedirectUrl }); const { externalVerificationRedirectURL } = signIn.firstFactorVerification; + if (!externalVerificationRedirectURL) { + return errorThrower.throw('Missing external verification redirect URL for OAuth flow'); + } const authSessionResult = await WebBrowserModule.openAuthSessionAsync( - // @ts-ignore externalVerificationRedirectURL.toString(), oauthRedirectUrl, );