Crate azalea_auth

Source
Expand description

§Azalea Auth

A port of Mojang’s Authlib and launcher authentication.

§Examples

use std::path::PathBuf;

#[tokio::main]
async fn main() {
    let cache_file = PathBuf::from("example_cache.json");

    let auth_result = azalea_auth::auth(
        "[email protected]",
        azalea_auth::AuthOpts {
            cache_file: Some(cache_file),
            ..Default::default()
        },
    )
    .await
    .unwrap();
    println!("{auth_result:?}");
}

Thanks to wiki.vg contributors, Overhash, and prismarine-auth contributors.

Modules§

cache
Cache auth information
certs
game_profile
offline
sessionserver
Tell Mojang you’re joining a multiplayer server.

Structs§

AccessTokenResponse
AuthOpts
AuthResult
DeviceCodeResponse
GameOwnershipItem
GameOwnershipResponse
MinecraftAuthResponse
MinecraftTokenResponse
ProfileResponse
XboxLiveAuth
Just the important data
XboxLiveAuthResponse

Enums§

AuthError
CheckOwnershipError
GetMicrosoftAuthTokenError
GetProfileError
MinecraftAuthError
MinecraftXstsAuthError
RefreshMicrosoftAuthTokenError
XboxLiveAuthError

Functions§

auth
Authenticate with Microsoft. If the data isn’t cached, they’ll be asked to go to log into Microsoft in a web page.
check_ownership
get_minecraft_token
Authenticate with Minecraft when we already have a Microsoft auth token.
get_ms_auth_token
Wait until the user logged into Microsoft with the given code. You get the device code response needed for this function from get_ms_link_code.
get_ms_link_code
Get the Microsoft link code that’s shown to the user for logging into Microsoft.
get_profile
interactive_get_ms_auth_token
Asks the user to go to a webpage and log in with Microsoft. If you need to access the code, then use get_ms_link_code and then get_ms_auth_token instead.
refresh_ms_auth_token