Reading 'hasValidAuth0Instance' error on web build

Missing NativeModule. React Native versions 0.60 and up perform auto-linking. Please see https://github.com/react-native-community/cli/blob/master/docs/autolinking.md.

this only happens to me on web but working fine on ios and android

versions:
“expo”: “~52.0.11”,
“react-native-auth0”: “^3.2.1”

Hi @coderph,

Thanks for reaching out to the Auth0 Community!

It looks like the error is indicating that there is a missing NativeModule and to perform auto-linking as a resolution. And since you are using a React Native version higher than 0.60, this is required.

Have you had a chance to implement autolinking in your app as mentioned in this link?

Thanks,
Rueben

Yes I did. I still get the same issue

I am confuse because this only happen on web

Hi @coderph,

After looking into this further, the issue seems to be derived from missing the audience parameter in the authorize() call.

In this case, you would have to pass in the audience parameter when calling authorize().

For example:

const onLogin = async () => {
    try {
      await authorize({ audience: 'https://test.api'});
      let credentials = await getCredentials();
      Alert.alert('AccessToken: ' + credentials.accessToken);
    } catch (e) {
      console.log(e);
    }
  };

(Reference: react-native-auth0/src/hooks/__tests__/use-auth0.spec.jsx at e1771491969934cc20dd3ed0e8beeb6c5cf70577 · auth0/react-native-auth0 · GitHub)

Let me know how this goes for you.

Thanks,
Rueben