React Native Auth0 Possible Unhandled Promise Rejection

In setting up authentication, I’ve made some progress with the docs, but I’ve come into this error.

WARN Possible Unhandled Promise Rejection (id: 0):
TypeError: null is not an object (evaluating ‘this.Auth0Module.hasValidCredentialManagerInstance’)

My understanding of the error is that it is saying, ‘we can’t find any value for the Auth0Module object property you are looking for’. Is that a fair judgment? Would appreciate some advice on how solve this error?

I have set up the Application URIs (callback and logout) on the Auth0 website to include my applicationId which I found in ./root/android/app/build.gradle. I have tested my rn-dotenv vars and they work

I haven’t worked much with react-native. I would love to get tips on the best ways to debug in it and hear of good resources that you can recommend to :slight_smile:

This is my app code currently. Taken straight from the doc site

import {AUTH0_DOMAIN, CLIENT_ID} from '@env';
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { Button, StyleSheet, Text, View } from 'react-native';
import {useAuth0, Auth0Provider} from 'react-native-auth0';

export default function App() {
  return (
    <Auth0Provider domain={AUTH0_DOMAIN} clientId={CLIENT_ID}>
      <Home />
    </Auth0Provider>
  );
};

const Home = () => {
  const {authorize, clearSession, user} = useAuth0();

  const onLogin = async () => {
    try {
      await authorize({scope: 'openid profile email'});
    } catch (e) {
      console.log(e);
    }
  };

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

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

  return (
    <View style={styles.container}>
      {loggedIn && <Text>You are logged in as {user.name}</Text>}
      {!loggedIn && <Text>You are not logged in</Text>}

      <Button
        onPress={loggedIn ? onLogout : onLogin}
        title={loggedIn ? 'Log Out' : 'Log In'}
      />
    </View>
  );
};

console.log(AUTH0_DOMAIN);

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