JavaScript SDK Reference
Complete reference documentation for the JavaScript SDK including methods, events, and configuration

Comprehensive reference for the JavaScript SDK with TypeScript support.
Installation
npm install @authcompany/js-sdk
Initialization
import { AuthClient } from '@authcompany/js-sdk';
const auth = new AuthClient({
clientId: string;
domain: string;
redirectUri?: string;
audience?: string;
scope?: string;
});
Core Methods
loginWithRedirect()
Initiates login flow with redirect.
await auth.loginWithRedirect({
appState?: any;
loginHint?: string;
});
getUser()
Retrieves authenticated user profile.
const user = await auth.getUser();
// Returns: User | null
handleRedirectCallback()
Processes authentication callback.
const result = await auth.handleRedirectCallback();
// Returns: { appState?: any }
Events
auth.on('authenticated', (user) => {
console.log('User logged in:', user);
});
For advanced usage and configuration, see our advanced guides.