Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/react/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export function AuthProvider({
);

const signIn = useCallback(
async (provider?: string, args?: FormData | Record<string, Value>) => {
async (provider?: string, args?: FormData | Record<string, Value>, shouldRedirect: boolean = true) => {
const params =
args instanceof FormData
? Array.from(args.entries()).reduce(
Expand All @@ -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 };
Expand Down
6 changes: 6 additions & 0 deletions src/react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down