
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@authon/js
Advanced tools
English | 한국어
Drop-in browser authentication SDK — Auth0 alternative, open-source auth
Before installing the SDK, create an Authon project and get your API keys:
Create a project at Authon Dashboard
Get your API keys from Project Settings → API Keys
pk_live_...) — use in your frontend codepk_test_...) — for development, enables Dev TeleportConfigure OAuth providers (optional) in Project Settings → OAuth
https://api.authon.dev/v1/auth/oauth/redirectTest vs Live keys: Use
pk_test_...during development. Switch topk_live_...before deploying to production. Test keys use a sandbox environment with no rate limits.
npm install @authon/js
<!-- index.html -->
<!DOCTYPE html>
<html>
<head><title>My App</title></head>
<body>
<button id="sign-in-btn">Sign In</button>
<div id="user-info"></div>
<script type="module">
import { Authon } from '@authon/js';
const authon = new Authon('pk_live_YOUR_PUBLISHABLE_KEY');
document.getElementById('sign-in-btn').addEventListener('click', () => {
authon.openSignIn();
});
authon.on('signedIn', (user) => {
document.getElementById('user-info').textContent = `Hello, ${user.email}`;
document.getElementById('sign-in-btn').style.display = 'none';
});
</script>
</body>
</html>
import { Authon } from '@authon/js';
const authon = new Authon('pk_live_YOUR_PUBLISHABLE_KEY');
// Opens popup, falls back to redirect if blocked
await authon.signInWithOAuth('google');
// Force redirect mode
await authon.signInWithOAuth('google', { flowMode: 'redirect' });
// Supported providers: google, apple, github, discord, facebook,
// microsoft, kakao, naver, line, x
import { Authon } from '@authon/js';
const authon = new Authon('pk_live_YOUR_PUBLISHABLE_KEY');
// Sign up
const user = await authon.signUpWithEmail('user@example.com', 'MyP@ssw0rd', {
displayName: 'Alice',
});
// Sign in
const user = await authon.signInWithEmail('user@example.com', 'MyP@ssw0rd');
// Synchronous — no network request
const user = authon.getUser();
// { id, email, displayName, avatarUrl, emailVerified, ... }
const token = authon.getToken();
// Use token for authenticated API calls
// ShadowDOM modal — no CSS conflicts with your app
await authon.openSignIn();
await authon.openSignUp();
await authon.signOut();
// Register passkey (user must be signed in)
const credential = await authon.registerPasskey('My MacBook');
// Sign in with passkey
const user = await authon.authenticateWithPasskey();
const { message } = await authon.web3GetNonce('0xAbc...', 'evm', 'metamask', 1);
const signature = await window.ethereum.request({
method: 'personal_sign',
params: [message, '0xAbc...'],
});
const user = await authon.web3Verify(message, signature, '0xAbc...', 'evm', 'metamask');
import { Authon, AuthonMfaRequiredError } from '@authon/js';
// Setup MFA (user must be signed in)
const setup = await authon.setupMfa();
document.getElementById('qr').innerHTML = setup.qrCodeSvg;
await authon.verifyMfaSetup('123456'); // code from authenticator app
// Sign in with MFA
try {
await authon.signInWithEmail('user@example.com', 'password');
} catch (err) {
if (err instanceof AuthonMfaRequiredError) {
const user = await authon.verifyMfa(err.mfaToken, '123456');
}
}
authon.on('signedIn', (user) => console.log('Signed in:', user.email));
authon.on('signedOut', () => console.log('Signed out'));
authon.on('error', (err) => console.error(err.message));
authon.on('mfaRequired', (mfaToken) => { /* show MFA dialog */ });
authon.on('tokenRefreshed', (token) => { /* update API client */ });
| Variable | Required | Description |
|---|---|---|
AUTHON_PUBLISHABLE_KEY | Yes | Project publishable key (pk_live_... or pk_test_...) |
AUTHON_API_URL | No | Optional — defaults to api.authon.dev |
new Authon(publishableKey: string, config?: AuthonConfig)
| Config Option | Type | Default | Description |
|---|---|---|---|
apiUrl | string | https://api.authon.dev | API base URL |
mode | 'popup' | 'embedded' | 'popup' | Modal display mode |
theme | 'light' | 'dark' | 'auto' | 'auto' | UI theme |
locale | string | 'en' | UI locale |
containerId | string | -- | Element ID for embedded mode |
appearance | Partial<BrandingConfig> | -- | Override branding |
| Method | Returns |
|---|---|
openSignIn() | Promise<void> |
openSignUp() | Promise<void> |
signInWithEmail(email, password) | Promise<AuthonUser> |
signUpWithEmail(email, password, meta?) | Promise<AuthonUser> |
signInWithOAuth(provider, options?) | Promise<void> |
signOut() | Promise<void> |
getUser() | AuthonUser | null |
getToken() | string | null |
| Method | Returns |
|---|---|
sendMagicLink(email) | Promise<void> |
sendEmailOtp(email) | Promise<void> |
verifyPasswordless({ token?, email?, code? }) | Promise<AuthonUser> |
| Method | Returns |
|---|---|
registerPasskey(name?) | Promise<PasskeyCredential> |
authenticateWithPasskey(email?) | Promise<AuthonUser> |
listPasskeys() | Promise<PasskeyCredential[]> |
renamePasskey(id, name) | Promise<PasskeyCredential> |
revokePasskey(id) | Promise<void> |
| Method | Returns |
|---|---|
web3GetNonce(address, chain, walletType, chainId?) | Promise<Web3NonceResponse> |
web3Verify(message, signature, address, chain, walletType) | Promise<AuthonUser> |
listWallets() | Promise<Web3Wallet[]> |
linkWallet(params) | Promise<Web3Wallet> |
unlinkWallet(walletId) | Promise<void> |
| Method | Returns |
|---|---|
setupMfa() | Promise<MfaSetupResponse & { qrCodeSvg }> |
verifyMfaSetup(code) | Promise<void> |
verifyMfa(mfaToken, code) | Promise<AuthonUser> |
getMfaStatus() | Promise<MfaStatus> |
disableMfa(code) | Promise<void> |
regenerateBackupCodes(code) | Promise<string[]> |
| Method | Returns |
|---|---|
organizations.list() | Promise<OrganizationListResponse> |
organizations.create(params) | Promise<AuthonOrganization> |
organizations.get(orgId) | Promise<AuthonOrganization> |
organizations.update(orgId, params) | Promise<AuthonOrganization> |
organizations.delete(orgId) | Promise<void> |
organizations.invite(orgId, params) | Promise<OrganizationInvitation> |
| Event | Payload |
|---|---|
signedIn | AuthonUser |
signedOut | -- |
tokenRefreshed | string |
mfaRequired | string (mfaToken) |
passkeyRegistered | PasskeyCredential |
web3Connected | Web3Wallet |
error | Error |
| Feature | Authon | Clerk | Auth.js |
|---|---|---|---|
| Pricing | Free | $25/mo+ | Free |
| OAuth providers | 10+ | 20+ | 80+ |
| ShadowDOM modal | Yes | No | No |
| MFA/Passkeys | Yes | Yes | Plugin |
| Web3 auth | Yes | No | No |
| Organizations | Yes | Yes | No |
MIT
FAQs
Authon core browser SDK — ShadowDOM login modal, OAuth, session management
The npm package @authon/js receives a total of 124 weekly downloads. As such, @authon/js popularity was classified as not popular.
We found that @authon/js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.