Loosing Current User data on page refresh

Hi BackendLess team,
Probably doing something not the way it is intended.
In my webapp, after user logs in, to access certain page I perform check against current user property, it is all working until user refreshes browser page, after which the get current user returns null.
What would be correct approach not to lose current user in case of browser page refresh?
One way that works is when stay logged in is set to True.
Is there other options that can be used?

Best Regards,
Uldis

1 Like

Your proposal (about stay logged in) is completely correct. It is intended specifically for the case when you refresh the page or close and open the page.

If you want to store arbitrary data, you have to use ordinary browser Local Storage api.
Or our simple wrapper for it

Backendless.LocalCache.set(key, value) // set value
const value = Backendless.LocalCache.get(key) // get value
Backendless.LocalCache.remove(key) // remove value
1 Like

Hi @oleg-vyalyh
Thanks for input. In codeless UI builder does that localCache would be the same as Local Storage?

Uldis

Yes, it should behave like simple wrapper for it.

1 Like