Authentication
AeThex Passport provides secure, universal authentication across all your applications.
Supported Providers
- OAuth 2.0 — Google, Discord, GitHub, Twitter, Steam
- Email/Password — Traditional authentication with MFA support
- Wallet — Ethereum, Solana, and other blockchain wallets
- SSO — Enterprise single sign-on (SAML, OIDC)
Basic Authentication
// Initialize auth
const auth = aethex.auth;
// Sign in with OAuth
const session = await auth.signIn({
provider: 'discord',
scopes: ['identity', 'email']
});
// Check auth state
if (auth.isAuthenticated) {
console.log('User:', auth.user.id);
}
Session Management
// Get current session
const session = await auth.getSession();
// Refresh token
await auth.refreshToken();
// Sign out
await auth.signOut();
Multi-Factor Authentication
// Enable MFA
await auth.mfa.enable({
method: 'totp' // or 'sms', 'email'
});
// Verify MFA code
await auth.mfa.verify({
code: '123456'
});