Check if user is authenticated or not -> auth-js sdk

Hi! i implementing the auth.js sdk and i not find a method to hide a login button or show a logout button when the user is authenticated. The auth-spa-sdk have isAuthenticated() for example. How is the approach in this case ?

Hi @guidobessone,

I would guide you towards the old vanilla js quickstart that used auth0js:

You will notice that the quickstart defines a method for isAuthenticated, and handles the check by looking for an exp time in localstorage. This is similar to how it is handled in auth0-spa0-js, but you have to build it out yourself or use the quickstart.

I would recommend auth0-spa-js if you do not have a specific reason to use auth0js instead.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.