Hello,
I am receiving this message when following the set-up steps for a React Native project built with Expo. I have run npx expo prebuild, so I am not using Expo GO, I am using a development build.
Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property ‘hasValidAuth0Instance’ of null
I’ve followed the set up steps from Auth0’s documentation here:
and have ensured my domain and clientId are correct, as well as making sure the bundle identifiers are correct in the app.json.
Seems like others have had this issue, but I haven’t found a clear solution.
1 Like
I have the same issue, but only on iOS so far, if I try on the android simulator it works
I haven’t tried the iOS simulator, and I don’t have a physical android device to try out
Hi @stuttskl
Thank you for posting your inquiry on the Auth0 Community!
I am sorry about the late reply to your post.
You might be missing the audience parameter in the authorize()
call. You would have to pass the audience parameter when you make the call as follows:
const onLogin = async () => {
try {
await authorize({ audience: 'https://test.api'});
let credentials = await getCredentials();
Alert.alert('AccessToken: ' + credentials.accessToken);
} catch (e) {
console.log(e);
}
};
This code is referenced here: react-native-auth0/src/hooks/tests/use-auth0.spec.jsx at e1771491969934cc20dd3ed0e8beeb6c5cf70577 · auth0/react-native-auth0 · GitHub
If you have any other questions on the matter or found a solution to it already, feel free to let us know by leaving a reply!
Kind Regards,
Nik