VanillaJS
Authentication State
Learn how to access and manage the user authentication state on the in your VanillaJS application.
Before we can begin to access authentication state, the Corbado.load()
call has to resolve.
Find more here.
One-time access to Authentication State
If you want to access user state once, you can simply call Corbado.sessionToken
,
Corbado.user
or Corbado.isAuthenticated
to get the current user state.
main.html
Subscribing to Authentication State
If you want to be informed about any updates in authentication state, you can subscribe to the authStateChanges
and userChanges
observables.
main.html
Logout
You can log out the user by calling Corbado.logout
.
main.html
Was this page helpful?