Skip to main content
You can create a hanko-frontend-sdk instance without registering the web components:

Events

You can bind callbacks to different custom events using the SDK’s event listener functions. The callback function will be called when the event occurs, and an object containing event details will be passed to it.

Session created

Triggered after a session has been created and the user has completed any additional steps (e.g., passkey registration or password recovery). It will also be triggered when the user logs in via another browser window. You can use this event to obtain the JWT.

Session expired

Triggered when the session has expired, or when the session has been removed in another browser window because the user has logged out or deleted their account.

User logged out

Triggered when the user actively logs out. In other browser windows, a “hanko-session-expired” event will be triggered at the same time.

User deleted

Triggered when the user has deleted their account. In other browser windows, a hanko-session-expired event will be triggered at the same time.

Common operations

The SDK provides functions that simplify interaction with the Hanko API. Here are some common operations: Get the session validity and JWT claims:
Retrieve the session token:
Get the user data:
Log out the user:
To learn about error handling and other SDK capabilities, check out the frontend-sdk docs.