1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

fix auto reauthentication

THANKS MOJANG
This commit is contained in:
mat 2023-01-05 18:28:35 -06:00
parent fc88dabd95
commit 82fad00240
2 changed files with 5 additions and 1 deletions

View file

@ -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)),
}
}

View file

@ -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?;