Class

Hanko

Hanko(api, optionsopt)

A class that bundles all available SDK functions.
Constructor

# new Hanko(api, optionsopt)

Parameters:
Name Type Attributes Description
api string The URL of your Hanko API instance
options HankoOptions <optional>
The options that can be used

View Source Hanko.ts, line 20

Extends

Methods

# onAuthFlowCompleted(callback, onceopt) → {CleanupFunc}

Adds an event listener for hanko-auth-flow-completed events. Will be triggered after the login or registration flow has been completed.
Parameters:
Name Type Attributes Description
callback CallbackFunc.<AuthFlowCompletedDetail> The function to be called when the event is triggered.
once boolean <optional>
Whether the event listener should be removed after being called once.
Overrides:

View Source lib/events/Listener.ts, line 131

This function can be called to remove the event listener.
CleanupFunc

# onSessionCreated(callback, onceopt) → {CleanupFunc}

Adds an event listener for "hanko-session-created" events. Will be triggered across all browser windows, when the user logs in, or when the page has been loaded or refreshed and there is a valid session.
Parameters:
Name Type Attributes Description
callback CallbackFunc.<SessionDetail> The function to be called when the event is triggered.
once boolean <optional>
Whether the event listener should be removed after being called once.
Overrides:

View Source lib/events/Listener.ts, line 88

This function can be called to remove the event listener.
CleanupFunc

# onSessionExpired(callback, onceopt) → {CleanupFunc}

Adds an event listener for "hanko-session-expired" events. The event will be triggered across all browser windows as soon as the current JWT expires or the user logs out. It also triggers, when the user deletes the account in another window.
Parameters:
Name Type Attributes Description
callback CallbackFunc.<null> The function to be called when the event is triggered.
once boolean <optional>
Whether the event listener should be removed after being called once.
Overrides:

View Source lib/events/Listener.ts, line 100

This function can be called to remove the event listener.
CleanupFunc

# onUserDeleted(callback, onceopt) → {CleanupFunc}

Adds an event listener for hanko-user-deleted events. The event triggers, when the user has deleted the account.
Parameters:
Name Type Attributes Description
callback CallbackFunc.<null> The function to be called when the event is triggered.
once boolean <optional>
Whether the event listener should be removed after being called once.
Overrides:

View Source lib/events/Listener.ts, line 121

This function can be called to remove the event listener.
CleanupFunc

# onUserLoggedOut(callback, onceopt) → {CleanupFunc}

Adds an event listener for hanko-user-deleted events. The event triggers, when the user has deleted the account in the browser window where the deletion happened.
Parameters:
Name Type Attributes Description
callback CallbackFunc.<null> The function to be called when the event is triggered.
once boolean <optional>
Whether the event listener should be removed after being called once.
Overrides:

View Source lib/events/Listener.ts, line 111

This function can be called to remove the event listener.
CleanupFunc