User persistence when app restarts

Hello,

I’m developing an app using the latest Backendless JS SDK.

I’m trying to implement user persistence among app restarts but I’m being unable of. I’ve been reading other topics about the subject, and have downloaded the latest SDK. The code about user persistence is as follows:

if (Backendless.LocalCache.get(“user-token”)) {
Backendless.UserService.isValidLogin(new Backendless.Async(function(data) {
var currentUserObjectId = Backendless.UserService.loggedInUser();
_user = Backendless.Data.of(Backendless.User).findById(currentUserObjectId);

}
}, function(error) {

}));
}

Backendless.UserService.loggedInUser() always returns null or undefined, and I get the following error: “Uncaught Error: Invalid value for the “value” argument. The argument must contain only string or object values, http://localhost:8100/lib/backendless.js, Line: 1025” on the call Backendless.Data.of(Backendless.User).findById(currentUserObjectId).

This is a showstopper for me right now. Can you please provide a solution or workaround?

Thanks in advance,
Luís