Appearance
Registration & Login
Registration
The platform supports sign-up via Email or Phone. You can also pass a metadata object to store custom client data (e.g., affiliate codes, promo codes).
Note on IP & Device Tracking: The SDK does not send IP addresses or browser agents. These are captured automatically by your backend via standard HTTP headers (req.ip and req.headers['user-agent']).
javascript
// Email Registration
await sdk.auth.register({
signUpMode: 'EMAIL',
email: 'player@casino.com',
password: 'securePassword123',
username: 'HighRoller99',
metadata: {
affiliateId: 'AFF_123',
preferredCurrency: 'USD'
}
});
// Phone Registration
await sdk.auth.register({
signUpMode: 'PHONE',
phone: '+1234567890',
password: 'securePassword123',
username: 'HighRoller99'
});Login
Login accepts a single identifier field. The backend will resolve whether the user typed an email, phone, or username.
javascript
await sdk.auth.login({
identifier: 'player@casino.com', // or '+1234567890' or 'HighRoller99'
password: 'securePassword123'
});Two-Factor Authentication (2FA) Challenge
If a user has 2FA enabled, the login() method will not return a session. Instead, it returns a tempToken. Your frontend must catch this and ask the user for their 6-digit Authenticator code.
javascript
try {
await sdk.auth.login({ identifier: 'user', password: 'pass' });
} catch (error) {
if (error.name === 'TwoFactorRequiredError') {
const tempToken = error.tempToken; // Store this temporarily
// Show 2FA input screen to the user
}
}
// Once the user provides their 6-digit code:
await sdk.auth.verifyLogin2FA(tempToken, '123456');