lighty-auth 26.5.6

Authentication modules for Lighty Launcher
Documentation

lighty-auth

Multi-provider authentication system for Minecraft launchers with OAuth2 and CMS integrations.

Overview

Version: 26.5.1 Part of: LightyLauncher

lighty-auth provides a unified trait-based authentication system supporting multiple providers:

  • Offline Mode - Local authentication without network, generates deterministic UUIDs
  • Microsoft Account - OAuth 2.0 Device Code Flow via Microsoft/Xbox Live/Minecraft Services
  • Azuriom CMS - Server authentication with 2FA support, roles, and permissions
  • Custom Providers - Implement the Authenticator trait for your own auth system

Quick Start

[dependencies]
lighty-auth = "26.5.1"

Offline Authentication

use lighty_auth::{offline::OfflineAuth, Authenticator};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut auth = OfflineAuth::new("PlayerName");

    #[cfg(feature = "events")]
    let profile = auth.authenticate(None).await?;

    #[cfg(not(feature = "events"))]
    let profile = auth.authenticate().await?;

    println!("Username: {}", profile.username);
    println!("UUID: {}", profile.uuid);

    Ok(())
}

Microsoft Authentication

use lighty_auth::{microsoft::MicrosoftAuth, Authenticator};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut auth = MicrosoftAuth::new("your-azure-client-id");

    // Display device code to user
    auth.set_device_code_callback(|code, url| {
        println!("Please visit: {}", url);
        println!("And enter code: {}", code);
    });

    #[cfg(feature = "events")]
    let profile = auth.authenticate(None).await?;

    #[cfg(not(feature = "events"))]
    let profile = auth.authenticate().await?;

    println!("Logged in as: {}", profile.username);

    Ok(())
}

Authentication Providers

Provider Status Network Use Cases
Offline ✅ Stable Not required Testing, offline play, development
Microsoft ✅ Stable Required Legitimate Minecraft accounts
Azuriom ✅ Stable Required Custom server authentication, launcher whitelisting

Features

  • Trait-based - Implement Authenticator for custom providers
  • Event integration - Track authentication progress with events
  • 2FA support - Azuriom two-factor authentication
  • Offline UUIDs - Deterministic UUID generation
  • Role system - User roles with colors and permissions

Documentation

📚 Complete Documentation

Guide Description
How to Use Practical authentication guide with examples
Overview Architecture and design patterns
Exports Complete export reference
Events AuthEvent types
Offline Offline mode and UUID generation
Microsoft Microsoft OAuth2 flow
Azuriom Azuriom CMS authentication
Trait Implementing custom Authenticator

Related Crates

License

MIT