aboutsummaryrefslogtreecommitdiff
path: root/azalea-auth/examples
diff options
context:
space:
mode:
authorAditya Kumar <117935160+AS1100K@users.noreply.github.com>2024-08-12 03:24:45 +0530
committerGitHub <noreply@github.com>2024-08-11 16:54:45 -0500
commit13afc1d6a42d28f01087fb59ca868696be4a2635 (patch)
treea3b77e5a7529c764a9f384407b580e273b0b3b55 /azalea-auth/examples
parent92c90753eac774add5d033a567f9af115dad4ea0 (diff)
downloadazalea-drasl-13afc1d6a42d28f01087fb59ca868696be4a2635.tar.xz
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>
Diffstat (limited to 'azalea-auth/examples')
-rwxr-xr-xazalea-auth/examples/auth_manual.rs5
1 files changed, 3 insertions, 2 deletions
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<dyn Error>> {
Ok(())
}
+// We will be using default `client_id` and `scope`
async fn auth() -> Result<ProfileResponse, Box<dyn Error>> {
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?)
}