Single page application - check session offline

After a successful login on my SPA, I want to perform a session check each time a person navigates between pages. Can I do it without going to the server? I just want a simple check that is fast. As far as I understand, the isAuthenticated API call checks it online.

Thanks!
David

Just to confirm, you mean the Auth0 session layer, right?
Referring to Sessions → Session Layers

isauthenticated as per
https://auth0.github.io/auth0-spa-js/classes/auth0client.html#isauthenticated

returns true if there’s valid information stored, otherwise returns false.

Looking at the source code:

it’s calling this.getUser()

which in turn checks if there’s valid information from the decoded ID Token in the cache.

So, no, it doesn’t check for a valid session. It checks for valid user information in the SPA SDK cache.

What’s your intention with this session check - what do you need this info for? If you want to check for a valid Auth0 session, you need to check against the Auth0 server (no way to check that offline), for which you can use the silent authentication approach.