# TypeError: Cannot read property 'hasValidAuth0Instance' of null

**URL:** <https://community.auth0.com/t/typeerror-cannot-read-property-hasvalidauth0instance-of-null/118432>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [October 12, 2023, 7:26pm UTC](https://community.auth0.com/t/typeerror-cannot-read-property-hasvalidauth0instance-of-null/118432 "2023-10-12T19:26:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![voit](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@voit](https://community.auth0.com/u/voit)\
**Post date:** [October 12, 2023, 7:26pm UTC](https://community.auth0.com/t/typeerror-cannot-read-property-hasvalidauth0instance-of-null/118432/1 "2023-10-12T19:26:40Z")

</div>

Hello . I am a new user and I have never used auth0 .  
when i start my react native app , the app shows me the text ‘loading…’

this is my code i copied it from auth quickstarts but it does not work

import { Button, Text, View, StyleSheet } from “react-native”;  
import { useAuth0 } from “react-native-auth0”;

const AuthScreen = () =\> {  
const { authorize, clearSession, user, error, isLoading } = useAuth0();  
const onLogin = async () =\> {  
try {  
await authorize();  
} catch (e) {  
console.log(e);  
}  
};

const onLogout = async () =\> {  
try {  
await clearSession();  
} catch (e) {  
console.log(“Log out cancelled”);  
}  
};

if (isLoading) {  
return (  
  
Loading  
  
);  
}

const loggedIn = user !== undefined && user !== null;

return (  
  
{loggedIn && You are logged in as {user.name}}  
{!loggedIn && You are not logged in}  
{error && {error.message}}

```
  <Button
    onPress={loggedIn ? onLogout : onLogin}
    title={loggedIn ? "Log Out" : "Log In"}
  />
</View>

```

);  
};  
const styles = StyleSheet.create({  
container: {  
flex: 1,  
justifyContent: “center”,  
alignItems: “center”,  
backgroundColor: “#F5FCFF”,  
},  
});  
export default AuthScreen;

import { Auth0Provider } from “react-native-auth0”;  
import { DOMAIN\_AUTH0, CLIENT\_ID\_AUTH0 } from “@env”;

export default function App() {  
return (  
  
  
  
  
  
);  
}

console:

WARN Possible Unhandled Promise Rejection (id: 0):  
TypeError: Cannot read property ‘hasValidAuth0Instance’ of null

react-native-auth0 is installed  
env variables are correct

I will be happy if you will help me . thank you

---

<div class="post-metadata">

**Author:** ![ceres](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ceres/32/49632_2.png) [@ceres](https://community.auth0.com/u/ceres)\
**Post date:** [October 14, 2023, 9:43pm UTC](https://community.auth0.com/t/typeerror-cannot-read-property-hasvalidauth0instance-of-null/118432/2 "2023-10-14T21:43:59Z")

</div>

I’m assuming that you are using expo go to test the app

It’s not working through expo go [javascript - Setting up Auth0 in React Native/Expo - Stack Overflow](https://stackoverflow.com/questions/75089887/setting-up-auth0-in-react-native-expo)

---

<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:** [October 28, 2023, 9:44pm UTC](https://community.auth0.com/t/typeerror-cannot-read-property-hasvalidauth0instance-of-null/118432/3 "2023-10-28T21:44:32Z")

</div>

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