User is not returned from login and app.currentUser is an empty object - Mongo Realm Sync

Viewed 332

I couldn't find a similar question so I will ask here: I'm using the Realm library and the react-native SDK to build an app. I started by running the example app https://github.com/mongodb-university/realm-tutorial-react-native I can start the app in xcode, login, and register, and even add a task, but every time I try to get the current user that is signed to the app it gives me an empty object.

For example I have tried to log the user (code is taken from the repo mentioned above - Auth Provider):

  const signIn = async (email, password) => {
    const creds = Realm.Credentials.emailPassword(email, password);
    const newUser = await app.logIn(creds);
    console.log('====', { newUser, creds, app: app.currentUser });

    setUser(newUser);
  };

The log I get is: LOG ==== {"app": {}, "creds": {}, "newUser": {}}

As I mentioned the app is WORKING and I can see the users and tasks added OK on the Realm UI app. What am I missing? How can I get the user? (I would like to save it in a secured storage and in the app state to change the screens depending on the auth state of the user)

0 Answers
Related