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:
parent
fc88dabd95
commit
82fad00240
2 changed files with 5 additions and 1 deletions
|
@ -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)),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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?;
|
||||
|
|
Loading…
Add table
Reference in a new issue