Events
Overview
AuthEvent Types
AuthenticationStarted
use lighty_event::{EventBus, Event, AuthEvent};
use lighty_auth::{offline::OfflineAuth, Authenticator};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let event_bus = EventBus::new(1000);
let mut receiver = event_bus.subscribe();
tokio::spawn(async move {
while let Ok(event) = receiver.next().await {
if let Event::Auth(AuthEvent::AuthenticationStarted { provider }) = event {
println!("Starting authentication with: {:?}", provider);
}
}
});
let mut auth = OfflineAuth::new("Player");
auth.authenticate(Some(&event_bus)).await?;
Ok(())
}DeviceCodeReceived
WaitingForUser
AuthenticationSuccess
AuthenticationFailed
Complete Event Flow
Offline Authentication
Microsoft Authentication (Success)
Microsoft Authentication (Failure)
Azuriom Authentication
Related Documentation
Last updated