Account Management
LiquidBounce features a comprehensive account management system that allows you to manage multiple Minecraft accounts and switch between them seamlessly. TheAccountManager handles all account operations including authentication, storage, and session management.
Account Types
LiquidBounce supports multiple account types through theAccountService system:
Microsoft Account
Premium accounts authenticated through Microsoft OAuth2 flow. Can join online servers.
Session Account
Accounts using session tokens. Can join online servers.
TheAltening
Accounts from TheAltening service. Can join online servers.
Cracked Account
Offline mode accounts. Can only join cracked servers.
Adding Accounts
Microsoft Account
Microsoft accounts use the OAuth2 authentication flow:- Calls
MicrosoftAccount.buildFromOpenBrowser()with anOAuthHandler - Opens a browser window for user authentication
- Receives authentication callback
- Stores the account in the accounts list
- Saves to configuration via
ConfigSystem.store()
The
AccountManager prevents multiple simultaneous login attempts by caching the active OAuth URL.Session Account
Add an account using a session token:- Microsoft refresh tokens (starting with “M.”)
- Session tokens from other sources
Cracked Account
Create an offline mode account:TheAltening
Add accounts from TheAltening service:Managing Accounts
Login to Account
Switch to a different account by ID:- Validates the account exists
- Calls
account.login()to get session credentials - Creates a
SessionWithServiceinstance - Generates profile keys for signing
- Updates
mc.userwith new session - Updates Minecraft services (session service, profile repository)
- Fires
SessionEventandAccountManagerLoginResultEvent
Direct Login
Login directly without storing the account:Restore Initial Session
Return to the original session from client startup:The initial session is captured during
AccountManager initialization and preserved for restoration.Account Organization
Account Storage
Accounts are stored in the configuration system:AccountManager is registered as a root config:
ConfigSystem.store(this@AccountManager).
Events
The account system fires several events:Session Management
LiquidBounce preserves session state throughSessionBundle:
- User profile and credentials
- Authentication services
- Profile key pairs for message signing
Code References
AccountManager.kt
Main account management logic
src/main/kotlin/net/ccbluex/liquidbounce/features/account/AccountManager.ktAccountService.kt
Account service type definitions
src/main/kotlin/net/ccbluex/liquidbounce/features/account/AccountService.ktOAuthClient.kt
OAuth authentication flow
src/main/kotlin/net/ccbluex/liquidbounce/api/services/auth/OAuthClient.ktSessionBundle.kt
Session state preservation
src/main/kotlin/net/ccbluex/liquidbounce/features/account/SessionBundle.kt