diff --git a/packages/expo/src/provider/ClerkProvider.tsx b/packages/expo/src/provider/ClerkProvider.tsx index b5d390eb43..1ff7dbdc14 100644 --- a/packages/expo/src/provider/ClerkProvider.tsx +++ b/packages/expo/src/provider/ClerkProvider.tsx @@ -1,9 +1,10 @@ import '../polyfills'; import { ClerkProvider as ClerkReactProvider } from '@clerk/clerk-react'; +import * as WebBrowser from 'expo-web-browser'; import type { TokenCache } from '../caches/types'; -import { isNative } from '../utils/runtime'; +import { isNative, isWeb } from '../utils/runtime'; import { getClerkInstance } from './singleton'; export type ClerkProviderProps = React.ComponentProps & { @@ -19,6 +20,11 @@ export function ClerkProvider(props: ClerkProviderProps): JSX.Element { const { children, tokenCache, publishableKey, ...rest } = props; const pk = publishableKey || process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || ''; + if (isWeb()) { + // This is needed in order for useOAuth to work correctly on web. + WebBrowser.maybeCompleteAuthSession(); + } + return (