From 431f9e90a782c42f9d28a85d1d18288e352d3e0c Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Wed, 7 Dec 2022 21:58:42 -0600 Subject: Reauth on invalid session (#50) * Reauth on invalid session * fix to actually use new token and retry auth * fix unused vars --- azalea-auth/src/sessionserver.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'azalea-auth/src') diff --git a/azalea-auth/src/sessionserver.rs b/azalea-auth/src/sessionserver.rs index fe0b694a..800a9642 100755 --- a/azalea-auth/src/sessionserver.rs +++ b/azalea-auth/src/sessionserver.rs @@ -13,6 +13,10 @@ pub enum SessionServerError { MultiplayerDisabled, #[error("This account has been banned from multiplayer")] Banned, + #[error("The authentication servers are currently not reachable")] + AuthServersUnreachable, + #[error("Invalid or expired session")] + InvalidSession, #[error("Unknown sessionserver error: {0}")] Unknown(String), #[error("Unexpected response from sessionserver (status code {status_code}): {body}")] @@ -64,6 +68,10 @@ pub async fn join( match forbidden.error.as_str() { "InsufficientPrivilegesException" => Err(SessionServerError::MultiplayerDisabled), "UserBannedException" => Err(SessionServerError::Banned), + "AuthenticationUnavailableException" => { + Err(SessionServerError::AuthServersUnreachable) + } + "InvalidCredentialsException" => Err(SessionServerError::InvalidSession), _ => Err(SessionServerError::Unknown(forbidden.error)), } } -- cgit v1.2.3