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.


Just to confirm, you mean the Auth0 session layer, right?
Referring to -> Session Layers

isauthenticated as per

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.