aboutsummaryrefslogtreecommitdiff
path: root/azalea-auth/src/auth.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-11-18 00:58:47 -0600
committermat <git@matdoes.dev>2023-11-18 00:58:47 -0600
commit9633508a3a31a70c657329fdeca0050b7082959e (patch)
tree9973ed4e60a0bd2b77413a195b2a166854f04d43 /azalea-auth/src/auth.rs
parentb79ae025f08935044c621259d4e0c4bb72bbcd7f (diff)
downloadazalea-drasl-9633508a3a31a70c657329fdeca0050b7082959e.tar.xz
replace log with tracing
Diffstat (limited to 'azalea-auth/src/auth.rs')
-rwxr-xr-xazalea-auth/src/auth.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs
index b0b30e1f..0c3b98c6 100755
--- a/azalea-auth/src/auth.rs
+++ b/azalea-auth/src/auth.rs
@@ -83,12 +83,12 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result<AuthResult, AuthError>
interactive_get_ms_auth_token(&client, email).await?
};
if msa.is_expired() {
- log::trace!("refreshing Microsoft auth token");
+ tracing::trace!("refreshing Microsoft auth token");
msa = refresh_ms_auth_token(&client, &msa.data.refresh_token).await?;
}
let msa_token = &msa.data.access_token;
- log::trace!("Got access token: {msa_token}");
+ tracing::trace!("Got access token: {msa_token}");
let res = get_minecraft_token(&client, msa_token).await?;
@@ -115,7 +115,7 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result<AuthResult, AuthError>
)
.await
{
- log::error!("{}", e);
+ tracing::error!("{}", e);
}
}
@@ -309,7 +309,7 @@ pub async fn get_ms_auth_token(
while Instant::now() < login_expires_at {
tokio::time::sleep(std::time::Duration::from_secs(res.interval)).await;
- log::trace!("Polling to check if user has logged in...");
+ tracing::trace!("Polling to check if user has logged in...");
if let Ok(access_token_response) = client
.post(format!(
"https://login.live.com/oauth20_token.srf?client_id={CLIENT_ID}"
@@ -324,7 +324,7 @@ pub async fn get_ms_auth_token(
.json::<AccessTokenResponse>()
.await
{
- log::trace!("access_token_response: {:?}", access_token_response);
+ tracing::trace!("access_token_response: {:?}", access_token_response);
let expires_at = SystemTime::now()
+ std::time::Duration::from_secs(access_token_response.expires_in);
return Ok(ExpiringValue {
@@ -348,7 +348,7 @@ pub async fn interactive_get_ms_auth_token(
email: &str,
) -> Result<ExpiringValue<AccessTokenResponse>, GetMicrosoftAuthTokenError> {
let res = get_ms_link_code(client).await?;
- log::trace!("Device code response: {:?}", res);
+ tracing::trace!("Device code response: {:?}", res);
println!(
"Go to \x1b[1m{}\x1b[m and enter the code \x1b[1m{}\x1b[m for \x1b[1m{}\x1b[m",
res.verification_uri, res.user_code, email
@@ -415,7 +415,7 @@ async fn auth_with_xbox_live(
"TokenType": "JWT"
});
let payload = auth_json.to_string();
- log::trace!("auth_json: {:#?}", auth_json);
+ tracing::trace!("auth_json: {:#?}", auth_json);
let res = client
.post("https://user.auth.xboxlive.com/user/authenticate")
.header("Content-Type", "application/json")
@@ -428,7 +428,7 @@ async fn auth_with_xbox_live(
.await?
.json::<XboxLiveAuthResponse>()
.await?;
- log::trace!("Xbox Live auth response: {:?}", res);
+ tracing::trace!("Xbox Live auth response: {:?}", res);
// not_after looks like 2020-12-21T19:52:08.4463796Z
let expires_at = DateTime::parse_from_rfc3339(&res.not_after)
@@ -469,7 +469,7 @@ async fn obtain_xsts_for_minecraft(
.await?
.json::<XboxLiveAuthResponse>()
.await?;
- log::trace!("Xbox Live auth response (for XSTS): {:?}", res);
+ tracing::trace!("Xbox Live auth response (for XSTS): {:?}", res);
Ok(res.token)
}
@@ -495,7 +495,7 @@ async fn auth_with_minecraft(
.await?
.json::<MinecraftAuthResponse>()
.await?;
- log::trace!("{:?}", res);
+ tracing::trace!("{:?}", res);
let expires_at = SystemTime::now() + std::time::Duration::from_secs(res.expires_in);
Ok(ExpiringValue {
@@ -522,7 +522,7 @@ async fn check_ownership(
.await?
.json::<GameOwnershipResponse>()
.await?;
- log::trace!("{:?}", res);
+ tracing::trace!("{:?}", res);
// vanilla checks here to make sure the signatures are right, but it's not
// actually required so we just don't
@@ -547,7 +547,7 @@ pub async fn get_profile(
.await?
.json::<ProfileResponse>()
.await?;
- log::trace!("{:?}", res);
+ tracing::trace!("{:?}", res);
Ok(res)
}