# Expo(+web) with Auth0: NativeModule is undefined and throwing error when using Auth0Provider in expo

**URL:** <https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [June 25, 2024, 12:14am UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242 "2024-06-25T00:14:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jirwincline](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jirwincline/32/58061_2.png) [@jirwincline](https://community.auth0.com/u/jirwincline)\
**Post date:** [June 25, 2024, 12:14am UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242/1 "2024-06-25T00:14:16Z")

</div>

After following the quick start, And implementing Auth0Provider on my main \_layout.tsx I was getting an error that indicated the Native Module for Auth0 was empty

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/0/50ff2adc2ff8d441d6dad78e09b0242e1dd4c019.png)

Is there a known issue? The only difference between the quick start and my situation is they’re showing an App.js instead of \_layout.tsx which is where the main routes of my app are set up

---

<div class="post-metadata">

**Author:** ![jirwincline](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jirwincline/32/58061_2.png) [@jirwincline](https://community.auth0.com/u/jirwincline)\
**Post date:** [June 25, 2024, 12:17am UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242/3 "2024-06-25T00:17:48Z")

</div>

A very simple use of Auth0Provider which causes the issue

```auto
import FontAwesome from '@expo/vector-icons/FontAwesome';
import {
  DarkTheme,
  DefaultTheme,
  ThemeProvider,
} from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { useEffect } from 'react';
import 'react-native-reanimated';

import { Auth0Provider } from 'react-native-auth0';

import { useColorScheme } from '@/hooks/useColorScheme';

export {
  // Catch any errors thrown by the Layout component.
  ErrorBoundary,
} from 'expo-router';

export const unstable_settings = {
  // Ensure that reloading on `/modal` keeps a back button present.
  initialRouteName: '(drawer)',
};

// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();

export default function RootLayout() {
  const [loaded, error] = useFonts({
    SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
    ...FontAwesome.font,
  });

  // Expo Router uses Error Boundaries to catch errors in the navigation tree.
  useEffect(() => {
    if (error) throw error;
  }, [error]);

  useEffect(() => {
    if (loaded) {
      SplashScreen.hideAsync();
    }
  }, [loaded]);

  if (!loaded) {
    return null;
  }

  return <RootLayoutNav />;
}

function RootLayoutNav() {
  const colorScheme = useColorScheme();

  return (
    <Auth0Provider
      clientId="xxx"
      domain="xxx"
    >
      <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
        <Stack>
          <Stack.Screen name="login" options={{ headerShown: false }} />
          <Stack.Screen name="(drawer)" options={{ headerShown: false }} />
          <Stack.Screen name="modal" options={{ presentation: 'modal' }} />
        </Stack>
      </ThemeProvider>
    </Auth0Provider>
  );
}

```

---

<div class="post-metadata">

**Author:** ![MrKrabs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mrkrabs/32/60933_2.png) [@MrKrabs](https://community.auth0.com/u/MrKrabs)\
**Post date:** [October 31, 2024, 11:22pm UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242/4 "2024-10-31T23:22:01Z")

</div>

The same problem for me, did you find a solution?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [January 31, 2025, 9:48pm UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242/5 "2025-01-31T21:48:15Z")

</div>

Hi @jirwincline

Welcome to the Auth0 Community!

I am sorry about the late reply to your inquiry

I would advise you to review this [community post](https://community.auth0.com/t/typeerror-cant-access-property-hasvalidauth0instance-nativemodule-is-undefined/128776) regarding the same issue that you are experiencing.

Let me know if you have any other questions regarding the matter or if you have found a solution by leaving a reply on the post!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 14, 2025, 9:48pm UTC](https://community.auth0.com/t/expo-web-with-auth0-nativemodule-is-undefined-and-throwing-error-when-using-auth0provider-in-expo/137242/7 "2025-02-14T21:48:55Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
