aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-01-05 18:28:35 -0600
committermat <github@matdoes.dev>2023-01-05 18:28:35 -0600
commit82fad002404d109ab3de3a004c424e6ba828814c (patch)
tree893a2493d7519190ef9aac4d1472156c518f1c6a
parentfc88dabd954e09450bf7f155f36829f5678b6171 (diff)
downloadazalea-drasl-82fad002404d109ab3de3a004c424e6ba828814c.tar.xz
fix auto reauthentication
THANKS MOJANG
-rwxr-xr-xazalea-auth/src/sessionserver.rs3
-rw-r--r--azalea-client/src/client.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/azalea-auth/src/sessionserver.rs b/azalea-auth/src/sessionserver.rs
index 46d1fc48..4ead502c 100755
--- a/azalea-auth/src/sessionserver.rs
+++ b/azalea-auth/src/sessionserver.rs
@@ -18,6 +18,8 @@ pub enum SessionServerError {
InvalidSession,
#[error("Unknown sessionserver error: {0}")]
Unknown(String),
+ #[error("Forbidden operation (expired session?)")]
+ ForbiddenOperation,
#[error("Unexpected response from sessionserver (status code {status_code}): {body}")]
UnexpectedResponse { status_code: u16, body: String },
}
@@ -71,6 +73,7 @@ pub async fn join(
Err(SessionServerError::AuthServersUnreachable)
}
"InvalidCredentialsException" => Err(SessionServerError::InvalidSession),
+ "ForbiddenOperationException" => Err(SessionServerError::ForbiddenOperation),
_ => Err(SessionServerError::Unknown(forbidden.error)),
}
}
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index c88cfc31..f5e72839 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -310,7 +310,8 @@ impl Client {
// both times, give up
return Err(e.into());
}
- if let SessionServerError::InvalidSession = e {
+ if matches!(e, SessionServerError::InvalidSession | ForbiddenOperation)
+ {
// uh oh, we got an invalid session and have
// to reauthenticate now
account.refresh().await?;