Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DIDIRUS4 committed Nov 3, 2023
1 parent f5c7f90 commit 8fb0131
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions theseus/src/api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,6 @@ pub async fn refresh(user: uuid::Uuid) -> crate::Result<Credentials> {
.as_error()
})?;

let offline = *state.offline.read().await;

if !offline {
let fetch_semaphore: &crate::util::fetch::FetchSemaphore =
&state.fetch_semaphore;
if Utc::now() > credentials.expires
&& inner::refresh_credentials(&mut credentials, fetch_semaphore)
.await
.is_err()
{
users.remove(credentials.id).await?;

return Err(crate::ErrorKind::OtherError(
"Please re-authenticate with your Minecraft account!"
.to_string(),
)
.as_error());
}

// Update player info from bearer token
let player_info =
hydra::stages::player_info::fetch_info(&credentials.access_token)
.await
.map_err(|_err| {
crate::ErrorKind::HydraError(
"No Minecraft account for your profile. Please try again or contact support in our Discord for help!".to_string(),
)
})?;

credentials.username = player_info.name;
users.insert(&credentials).await?;
}

Ok(credentials)
}

Expand Down

0 comments on commit 8fb0131

Please sign in to comment.