user.isLoggedIn property doesn't exist

I’m trying to use Realm’s user authentication via the Web SDK, but am having trouble understanding how to check if a user is currently logged in.

This example in the docs suggests that each use object should have a ‘isLoggedIn’ property. But for me this property is undefined.

Is there another way to check if a user is currently logged in?

Hi @Luke_Thorburn - welcome to the forum!

This is odd, what version of Realm Web are you using? Are you sure you’re using the latest? (1.0.0)

The user object also has a state property and you can check if it’s logged in with

user.state === UserState.Active

This is what isLoggedIn does under the hood.

Hi @kraenhansen, thanks for the quick response.

It was the version that was the issue, I was using 0.8.0 (which is currently used in the CDN example in the docs). May be worth updating.

Switched to 1.0.0 and it works fine.

Thank you!