From 13afc1d6a42d28f01087fb59ca868696be4a2635 Mon Sep 17 00:00:00 2001 From: Aditya Kumar <117935160+AS1100K@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:24:45 +0530 Subject: Auth Customization Options (#159) * Added Support for Custom Auth using `client_id` and `scope` * fix: `Account::microsoft` and added lifetime to `Account::microsoft_with_custom_client_id` * Added function `with_microsoft_access_token_and_custom_client_id` * Removed Custom Scope. * I got carried away, and made scope also customizable, later realized no customization is needed. * Better Documentation and Minor fixes * Added Custom Scope * Added RpsTicket format for custom `client_id` * Moved to non-static str * fix example Co-authored-by: mat <27899617+mat-1@users.noreply.github.com> * fix doc grammer * changed function signature * fmt * fixed example * removed dead code * Removed `d=` insertion in `client_id` * removed unnecessary `mut` --------- Co-authored-by: mat <27899617+mat-1@users.noreply.github.com> --- azalea-auth/examples/auth_manual.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'azalea-auth/examples') diff --git a/azalea-auth/examples/auth_manual.rs b/azalea-auth/examples/auth_manual.rs index 6a9510a8..05803c87 100755 --- a/azalea-auth/examples/auth_manual.rs +++ b/azalea-auth/examples/auth_manual.rs @@ -18,15 +18,16 @@ async fn main() -> Result<(), Box> { Ok(()) } +// We will be using default `client_id` and `scope` async fn auth() -> Result> { let client = reqwest::Client::new(); - let res = azalea_auth::get_ms_link_code(&client).await?; + let res = azalea_auth::get_ms_link_code(&client, None, None).await?; println!( "Go to {} and enter the code {}", res.verification_uri, res.user_code ); - let msa = azalea_auth::get_ms_auth_token(&client, res).await?; + let msa = azalea_auth::get_ms_auth_token(&client, res, None).await?; let auth_result = azalea_auth::get_minecraft_token(&client, &msa.data.access_token).await?; Ok(azalea_auth::get_profile(&client, &auth_result.minecraft_access_token).await?) } -- cgit v1.2.3