When using auth0-spa-js, should I use isAuthenticated() or getTokenSilently() to determine if a user has a valid token?

Viewed 341

I am using the auth0-spa-js SDK with VueJS.

When my application is navigating between pages I want to have the router navigation guard check to determine:

  • Has a user already been authenticated?
  • Is the current JWT the user has still valid?

auth0-spa-js has a couple methods that look like they could be used for this purpose:

My question is: Which of these would be better suited to this purpose?

isAuthenticated seems simpler, but I'm not sure if it checks whether the user's JWT is expired or not.

0 Answers
Related