minecraft-msa-auth
This crate allows you to authenticate into Minecraft online services using a Microsoft Oauth2 token. You can integrate it with oauth2-rs and build interactive authentication flows.
Example
const DEVICE_CODE_URL: &str = "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode";
const MSA_AUTHORIZE_URL: &str = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize";
const MSA_TOKEN_URL: &str = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
let client = new
.set_device_authorization_url;
let details: StandardDeviceAuthorizationResponse = client
.exchange_device_code?
.add_scope
.request_async
.await?;
println!;
let token = client
.exchange_device_access_token
.request_async
.await?;
println!;
let mc_flow = new;
let mc_token = mc_flow.exchange_microsoft_token.await?;
println!;
See full examples in the examples folder.
License
Except where noted (below and/or in individual files), all code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)