SyncUser.current() is null even after running logInAsync() with correct credentials


#1

I set up my credentials and then I call logInAsync. However, it never enters the onSuccess or onError functions. The error is also inconsistent; it doesn’t happen everytime. The error occurs when I try to set config = … because I am using a null pointer.

SyncCredentials credentials = SyncCredentials.usernamePassword(email, password, true);
        RealmAsyncTask task = SyncUser.logInAsync(credentials, authURL, new SyncUser.Callback<SyncUser>() {
            @Override
            public void onSuccess(SyncUser result) {
                user = result;
            }

            @Override
            public void onError(ObjectServerError error) {
                System.out.println("failed");
            }
        });
String url = "realms://unbranded-metal-bacon.us1a.cloud.realm.io/travelin";
        config = SyncUser.current().createConfiguration(url).build();

#2

Answered here -