{"library":"onz-auth","title":"OnzAuth JavaScript SDK","description":"OnzAuth JavaScript SDK v1.0.26 (latest) for passwordless authentication using Email Magic Link and WebAuthN. It provides a simple popup or iframe-based login flow with automatic token storage in localStorage (access_token, id_token, refresh_token, expiry). The SDK is ESM-only (no CommonJS support) and requires a client ID from OnzAuth. It emits events ('authenticated', 'error', 'closed') and is designed for quick integration. Key differentiators: no callback URLs to configure, built-in WebAuthN support, and no password management. It is a client-side only library with a small API surface, released irregularly with bug fixes.","language":"javascript","status":"active","last_verified":"Sat May 09","install":{"commands":["npm install onz-auth"],"cli":null},"imports":["import onz from 'onz-auth'; const auth = new onz.Auth({ clientID: '...' });","import onz from 'onz-auth'; const auth = new onz.Auth({ clientID: '...' });","<script src=\"https://unpkg.com/onz-auth@1.0.26/dist/onz-auth-js-sdk.min.js\"></script>","auth.on('authenticated', (result) => { console.log(result.accessToken); });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import onz from 'onz-auth';\n\nconst auth = new onz.Auth({\n  clientID: process.env.ONZAUTH_CLIENT_ID ?? 'your-client-id',\n  containerID: 'auth-container',\n  isIframe: false\n});\n\nauth.on('authenticated', (authResult) => {\n  console.log('Access Token:', authResult.accessToken);\n  console.log('ID Token:', authResult.idToken);\n  console.log('Refresh Token:', authResult.refreshToken);\n  console.log('Expiry:', authResult.expiry);\n});\n\nauth.on('error', (errorMessage) => {\n  console.error('Auth error:', errorMessage);\n});\n\nauth.on('closed', () => {\n  console.log('Login window closed');\n});\n\n// Show login popup\nauth.showLogin();\n\n// Later, to logout:\nauth.logout();","lang":"javascript","description":"Initializes OnzAuth, listens for authentication events, triggers a login popup, and logs the tokens. Also demonstrates error handling and logout.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}