summaryrefslogtreecommitdiffstats
path: root/ozone/src/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ozone/src/auth.rs')
-rw-r--r--ozone/src/auth.rs25
1 files changed, 6 insertions, 19 deletions
diff --git a/ozone/src/auth.rs b/ozone/src/auth.rs
index cb905af..ca06e93 100644
--- a/ozone/src/auth.rs
+++ b/ozone/src/auth.rs
@@ -56,9 +56,9 @@ impl MsaAccount {
let to_scope = |f: &&str| Scope::new(String::from(*f));
if self.is_azure_client_id {
- AZURE_LOGIN_SCOPES.into_iter().map(to_scope)
+ AZURE_LOGIN_SCOPES.iter().map(to_scope)
} else {
- NON_AZURE_LOGIN_SCOPES.into_iter().map(to_scope)
+ NON_AZURE_LOGIN_SCOPES.iter().map(to_scope)
}
}
@@ -84,10 +84,8 @@ impl MsaAccount {
.request_async(client)
.await.map_err(|e| match e {
RequestTokenError::ServerResponse(res)
- if match res.error() {
- BasicErrorResponseType::Extension(s) if s == "interaction_required" || s == "consent_required" => true,
- _ => false
- } => AuthError::raw_msg(AuthErrorKind::InteractionRequired, "microsoft requested interactive login"),
+ if matches!(res.error(), BasicErrorResponseType::Extension(s) if s == "interaction_required" || s == "consent_required") =>
+ AuthError::raw_msg(AuthErrorKind::InteractionRequired, "microsoft requested interactive login"),
_ => AuthError::internal_msg_src("refresh", e)
})?;
@@ -228,7 +226,6 @@ impl MsaAccount {
#[cfg(test)]
mod test {
- use oauth2::ClientId;
use super::*;
#[tokio::test]
@@ -238,18 +235,8 @@ mod test {
let mut user = match tokio::fs::read_to_string("../test_stuff/test.json").await {
Ok(s) => serde_json::from_str::<MsaAccount>(&s).unwrap(),
Err(e) if e.kind() == tokio::io::ErrorKind::NotFound => {
- MsaAccount {
- player_profile: None,
- xuid: None,
- gamertag: None,
- player_info: None,
- //client_id: ClientId::new("00000000402b5328".into()),
- client_id: ClientId::new("60b6cc54-fc07-4bab-bca9-cbe9aa713c80".into()),
- is_azure_client_id: true,
- mc_token: None,
- xbl_token: None,
- refresh_token: None
- }
+ //MsaAccount::with_client_id("00000000402b5328", false)
+ MsaAccount::with_client_id("60b6cc54-fc07-4bab-bca9-cbe9aa713c80", true)
},
Err(e) => panic!("i/o error: {}", e)
};