API reference
The public surface of
@thunderid/browser, as documented in its reference pages.function
ConfigurationThe `initialize()` method accepts a configuration object that controls how the SDK connects to your ThunderID instance and manages authentication.
Example
import { ThunderIDBrowserClient } from '@thunderid/browser'const auth = new ThunderIDBrowserClient()await auth.initialize({clientId: '<your-client-id>',baseUrl: 'https://localhost:8090',})
function
Event HooksThe Browser SDK provides an event-driven system for reacting to authentication lifecycle events. Register callbacks using the `on()` method to respond to sign-in, sign-out, HTTP request events, and more.
Example
import { Hooks } from '@thunderid/browser'auth.on(Hooks.SignIn, (user) => {console.log('User signed in:', user.displayName)})auth.on(Hooks.SignOut, () => {console.log('User signed out')window.location.href = '/'})
function
ThunderIDBrowserClientThe `ThunderIDBrowserClient` is the core class of the `@thunderid/browser` SDK. It manages the full authentication lifecycle for browser-based applications, including sign-in, sign-out, token management, and authenticated HTTP requests.
Example
import { ThunderIDBrowserClient } from '@thunderid/browser'const auth = new ThunderIDBrowserClient()await auth.initialize({clientId: '<your-client-id>',baseUrl: 'https://localhost:8090',afterSignInUrl: window.location.origin,afterSignOutUrl: window.location.origin,})export default auth