1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # OAuth Device Flows
//!
//! A specialized Rust library that implements the OAuth 2.0 Device Authorization Grant (RFC 8628),
//! commonly known as the "device flow" or "device code flow". This authentication flow is
//! particularly useful for devices with limited input capabilities, headless systems, or CLI
//! applications where redirecting to a browser is impractical.
//!
//! ## Features
//!
//! - Complete implementation of the OAuth 2.0 Device Authorization Grant
//! - Support for multiple OAuth providers (Microsoft, Google, GitHub, etc.)
//! - Customizable polling strategies with exponential backoff
//! - Token caching and refresh mechanisms
//! - Strong typing for OAuth responses
//! - Comprehensive error handling and recovery
//! - Minimal dependencies for embedded use
//! - Async/await support
//! - Custom URI handling for verification
//! - QR code generation for device code display (optional feature)
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use oauth_device_flows::{DeviceFlow, DeviceFlowConfig, Provider};
//! use std::time::Duration;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Configure the device flow
//! let config = DeviceFlowConfig::new()
//! .client_id("your-client-id")
//! .scopes(vec!["user.read", "offline_access"])
//! .poll_interval(Duration::from_secs(5))
//! .max_attempts(12);
//!
//! // Create a device flow instance for Microsoft
//! let mut device_flow = DeviceFlow::new(Provider::Microsoft, config)?;
//!
//! // Start the device authorization flow
//! let auth_response = device_flow.initialize().await?;
//!
//! // Display information to the user
//! println!("To sign in, use a web browser to open the page {} and enter the code {} to authenticate.",
//! auth_response.verification_uri(),
//! auth_response.user_code());
//!
//! // Poll for the token
//! println!("Waiting for authentication...");
//! let token_response = device_flow.poll_for_token().await?;
//!
//! println!("Successfully authenticated!");
//! Ok(())
//! }
//! ```
pub use DeviceFlowConfig;
pub use DeviceFlow;
pub use ;
pub use Provider;
pub use TokenManager;
pub use ;