Examples
Basic Examples
Offline Authentication
use lighty_auth::{offline::OfflineAuth, Authenticator};
#[tokio::main]
async fn main() {
let mut auth = OfflineAuth::new("Steve");
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() {
let mut auth = MicrosoftAuth::new("your-azure-client-id");
auth.set_device_code_callback(|code, url| {
println!("Visit {} and enter: {}", url, code);
});
let profile = auth.authenticate().await?;
println!("Logged in as: {}", profile.username);
Ok(())
}Azuriom Authentication
Advanced Examples
Multi-Provider Launcher
Azuriom with 2FA
Token Caching and Verification
Event-Driven Authentication UI
Retry on Network Failure
Custom Authentication Provider
Parallel Authentication Attempts
Session Management
See Also
Last updated