From e33c9f4fdaa80847601cee9ac2dc26634da24fe2 Mon Sep 17 00:00:00 2001 From: Velka Date: Sat, 3 May 2025 19:33:18 +0200 Subject: [PATCH 1/2] feat: allow force disabling redirect --- src/react/client.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/react/client.tsx b/src/react/client.tsx index 06e5d96..dd05d74 100644 --- a/src/react/client.tsx +++ b/src/react/client.tsx @@ -221,7 +221,7 @@ export function AuthProvider({ ); const signIn = useCallback( - async (provider?: string, args?: FormData | Record) => { + async (provider?: string, args?: FormData | Record, shouldRedirect: boolean = true) => { const params = args instanceof FormData ? Array.from(args.entries()).reduce( @@ -243,7 +243,7 @@ export function AuthProvider({ const url = new URL(result.redirect); await storageSet(VERIFIER_STORAGE_KEY, result.verifier!); // Do not redirect in React Native - if (window.location !== undefined) { + if (window.location !== undefined && shouldRedirect) { window.location.href = url.toString(); } return { signingIn: false, redirect: url }; From dd9351dac9ece77de0aa6f5d1b33e0a03fa6d4d9 Mon Sep 17 00:00:00 2001 From: Velka Date: Sat, 3 May 2025 19:42:28 +0200 Subject: [PATCH 2/2] chore: type definition --- src/react/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/react/index.tsx b/src/react/index.tsx index 6ebdd3f..2464c2a 100644 --- a/src/react/index.tsx +++ b/src/react/index.tsx @@ -210,6 +210,12 @@ export type ConvexAuthActionsContext = { */ code?: string; }), + /** + * Whether to automatically redirect the user to the redirect URL. + * + * Defaults to `true`. + */ + shouldRedirect?: boolean, ): Promise<{ /** * Whether the call led to an immediate successful sign-in.