Skip to main content
LiquidBounce’s account system allows you to manage multiple Minecraft accounts and switch between them seamlessly without restarting the client.

Supported Account Types

The AccountManager (features/account/AccountManager.kt:48) supports multiple authentication methods:
  • Microsoft Accounts - Official Microsoft/Xbox authentication
  • Cracked Accounts - Offline mode accounts for cracked servers
  • Session Accounts - Use existing session tokens
  • Altening Accounts - Integration with TheAltening service

Adding Accounts

Microsoft Account

Microsoft accounts use OAuth2 authentication flow:
1

Initiate OAuth Flow

Call newMicrosoftAccount() which opens a browser window for authentication (AccountManager.kt:177)
2

Complete Authentication

Sign in with your Microsoft account in the browser
3

Automatic Addition

The account is automatically added to your account list upon successful authentication
The system automatically handles:
  • Profile key pair generation for secure authentication
  • Session service creation
  • Existing account replacement if the same account is added again

Cracked Account

For cracked/offline servers:
// Add a cracked account
AccountManager.newCrackedAccount("username", online = false)

// Login directly without saving
AccountManager.loginCrackedAccount("username", online = false)
Requirements:
  • Username must not be empty
  • Username must be 16 characters or less
  • Account must not already exist in the list

Session Token

Import accounts using session tokens:
// Microsoft refresh token (starts with "M.")
AccountManager.newSessionAccount("M.xxxx...")

// Regular session token
AccountManager.newSessionAccount("token")

Altening Account

// Add by token
AccountManager.newAlteningAccount("token")

// Generate new account with API token
AccountManager.generateAlteningAccount("apiToken")

Account Management

Switching Accounts

// Login to account by index
AccountManager.loginAccount(id)

// Restore original session
AccountManager.restoreInitial()
The system prevents concurrent login attempts using AtomicBoolean (AccountManager.kt:54).

Organizing Accounts

// Mark account as favorite
AccountManager.favoriteAccount(id)
AccountManager.unfavoriteAccount(id)

// Swap account positions
AccountManager.swapAccounts(index1, index2)

// Reorder accounts
AccountManager.orderAccounts(listOf(2, 0, 1, 3))

// Remove account
AccountManager.removeAccount(id)

Events

The account system fires events for UI integration:
  • AccountManagerLoginResultEvent - Login success/failure
  • AccountManagerAdditionResultEvent - Account addition result
  • AccountManagerRemovalResultEvent - Account removal confirmation
  • SessionEvent - Triggered when session changes

Configuration

Accounts are stored in the config system using ValueType.ACCOUNT (AccountManager.kt:50):
val accounts by list(name, mutableListOf<MinecraftAccount>(), ValueType.ACCOUNT)
The initial session is saved on startup for restoration (AccountManager.kt:52-65).

Security Features

  • Profile Key Pairs: Automatic creation for secure server communication (AccountManager.kt:92-99)
  • Service Integration: Proper session service and profile repository setup
  • Token Management: Secure handling of access and refresh tokens
  • Error Handling: Comprehensive error catching and event reporting

Implementation Details

The account manager integrates with Minecraft’s authentication system:
mc.user = session
mc.services = mc.services.with(
    service.createMinecraftSessionService(),
    service.servicesKeySet,
    service.createProfileRepository(),
)
mc.profileKeyPairManager = profileKeys
This ensures compatibility with all Minecraft server types while maintaining the flexibility to use alternative authentication methods.

Build docs developers (and LLMs) love