English | 한국어
@authon/shared

Shared types and constants for Authon SDK packages. This package is consumed internally by @authon/js, @authon/react, @authon/node, and all other Authon SDKs.
Note: This package is not intended for direct use in application code. Install the appropriate framework SDK instead (e.g., @authon/js, @authon/react, @authon/node).
Installation
npm install @authon/shared
pnpm add @authon/shared
Usage
import type {
AuthonUser,
AuthonSession,
AuthTokens,
BrandingConfig,
SessionConfig,
WebhookEvent,
MfaSetupResponse,
MfaStatus,
PasskeyCredential,
Web3Wallet,
Web3NonceResponse,
SessionInfo,
Web3Chain,
Web3WalletType,
OAuthProviderType,
WebhookEventType,
} from '@authon/shared';
import {
OAUTH_PROVIDERS,
PROVIDER_DISPLAY_NAMES,
PROVIDER_COLORS,
WEBHOOK_EVENTS,
API_KEY_PREFIXES,
DEFAULT_BRANDING,
DEFAULT_SESSION_CONFIG,
} from '@authon/shared';
Exported Types
Core
AuthonUser
The authenticated user object.
interface AuthonUser {
id: string;
projectId: string;
email: string | null;
displayName: string | null;
avatarUrl: string | null;
phone: string | null;
emailVerified: boolean;
phoneVerified: boolean;
isBanned: boolean;
publicMetadata: Record<string, unknown> | null;
lastSignInAt: string | null;
signInCount: number;
createdAt: string;
updatedAt: string;
}
AuthonSession
An active user session record (from the server SDK).
interface AuthonSession {
id: string;
userId: string;
ipAddress: string | null;
userAgent: string | null;
deviceName: string | null;
lastActiveAt: string | null;
createdAt: string;
expiresAt: string;
}
AuthTokens
Token pair returned after a successful sign-in.
interface AuthTokens {
accessToken: string;
refreshToken: string;
expiresIn: number;
user: AuthonUser;
}
SessionInfo
Simplified session info returned to clients (used in listSessions()).
interface SessionInfo {
id: string;
ipAddress: string | null;
userAgent: string | null;
createdAt: string;
lastActiveAt: string | null;
}
Branding & Config
BrandingConfig
Visual customization options for the Authon modal.
interface BrandingConfig {
logoDataUrl?: string;
brandName?: string;
primaryColorStart?: string;
primaryColorEnd?: string;
lightBg?: string;
lightText?: string;
darkBg?: string;
darkText?: string;
borderRadius?: number;
providerOrder?: string[];
hiddenProviders?: string[];
showEmailPassword?: boolean;
showDivider?: boolean;
termsUrl?: string;
privacyUrl?: string;
customCss?: string;
locale?: string;
showSecuredBy?: boolean;
}
SessionConfig
Session lifetime and concurrency settings.
interface SessionConfig {
accessTokenTtl?: number;
refreshTokenTtl?: number;
maxSessions?: number;
singleSession?: boolean;
}
MFA
MfaSetupResponse
Returned by setupMfa().
interface MfaSetupResponse {
secret: string;
qrCodeUri: string;
backupCodes: string[];
}
MfaStatus
Returned by getMfaStatus().
interface MfaStatus {
enabled: boolean;
backupCodesRemaining: number;
}
Passkeys
PasskeyCredential
A registered WebAuthn passkey.
interface PasskeyCredential {
id: string;
name: string | null;
createdAt: string;
lastUsedAt: string | null;
}
Web3
Web3Chain
type Web3Chain = 'evm' | 'solana';
Web3WalletType
type Web3WalletType =
| 'metamask'
| 'pexus'
| 'walletconnect'
| 'coinbase'
| 'phantom'
| 'trust'
| 'other';
Web3Wallet
A linked Web3 wallet.
interface Web3Wallet {
id: string;
address: string;
chain: Web3Chain;
walletType: Web3WalletType;
chainId: number | null;
createdAt: string;
}
Web3NonceResponse
Returned by web3GetNonce().
interface Web3NonceResponse {
message: string;
nonce: string;
}
Webhooks
WebhookEvent
Incoming webhook payload from Authon.
interface WebhookEvent {
id: string;
type: string;
projectId: string;
timestamp: string;
data: Record<string, unknown>;
}
WebhookEventType
type WebhookEventType =
| 'user.created'
| 'user.updated'
| 'user.deleted'
| 'user.banned'
| 'user.unbanned'
| 'session.created'
| 'session.ended'
| 'session.revoked'
| 'provider.linked'
| 'provider.unlinked';
OAuth
OAuthProviderType
type OAuthProviderType =
| 'google'
| 'apple'
| 'kakao'
| 'naver'
| 'facebook'
| 'github'
| 'discord'
| 'x'
| 'line'
| 'microsoft';
Exported Constants
OAUTH_PROVIDERS
Readonly array of all supported OAuth provider identifiers.
const OAUTH_PROVIDERS: readonly OAuthProviderType[];
PROVIDER_DISPLAY_NAMES
Human-readable names for each provider.
const PROVIDER_DISPLAY_NAMES: Record<OAuthProviderType, string>;
PROVIDER_COLORS
Official brand colors (background and text) for each provider button.
const PROVIDER_COLORS: Record<OAuthProviderType, { bg: string; text: string }>;
WEBHOOK_EVENTS
Readonly array of all webhook event type strings.
const WEBHOOK_EVENTS: readonly WebhookEventType[];
API_KEY_PREFIXES
Prefix strings for Authon API keys.
const API_KEY_PREFIXES: {
PUBLISHABLE_LIVE: 'pk_live_';
PUBLISHABLE_TEST: 'pk_test_';
SECRET_LIVE: 'sk_live_';
SECRET_TEST: 'sk_test_';
};
DEFAULT_BRANDING
Default branding values applied when no project customization is set.
const DEFAULT_BRANDING: BrandingConfig;
DEFAULT_SESSION_CONFIG
Default session lifetime and concurrency settings.
const DEFAULT_SESSION_CONFIG: SessionConfig;
Documentation
Full documentation: docs.authon.dev
License
MIT