aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-11-27 16:29:30 -0600
committermat <github@matdoes.dev>2022-11-27 16:29:30 -0600
commit1a2178959d94232e96346a64785e8d8a639ab2b1 (patch)
tree3a68399a5afefa4d65afc89d08f57720dfa5a39f
parent631ed63dbdc7167df4de02a55b5c2ef1cea909e9 (diff)
downloadazalea-drasl-1a2178959d94232e96346a64785e8d8a639ab2b1.tar.xz
tell the user what email they're using in auth
-rwxr-xr-xazalea-auth/src/auth.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/azalea-auth/src/auth.rs b/azalea-auth/src/auth.rs
index dbdf3f0f..bed15d74 100755
--- a/azalea-auth/src/auth.rs
+++ b/azalea-auth/src/auth.rs
@@ -76,7 +76,7 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result<AuthResult, AuthError>
let mut msa = if let Some(account) = cached_account {
account.msa
} else {
- interactive_get_ms_auth_token(&client).await?
+ interactive_get_ms_auth_token(&client, email).await?
};
if msa.is_expired() {
log::trace!("refreshing Microsoft auth token");
@@ -230,6 +230,7 @@ pub enum GetMicrosoftAuthTokenError {
/// Asks the user to go to a webpage and log in with Microsoft.
async fn interactive_get_ms_auth_token(
client: &reqwest::Client,
+ email: &str,
) -> Result<ExpiringValue<AccessTokenResponse>, GetMicrosoftAuthTokenError> {
let res = client
.post("https://login.live.com/oauth20_connect.srf")
@@ -244,8 +245,8 @@ async fn interactive_get_ms_auth_token(
.await?;
log::trace!("Device code response: {:?}", res);
println!(
- "Go to \x1b[1m{}\x1b[m and enter the code \x1b[1m{}\x1b[m",
- res.verification_uri, res.user_code
+ "Go to \x1b[1m{}\x1b[m and enter the code \x1b[1m{}\x1b[m for \x1b[1m{}\x1b[m",
+ res.verification_uri, res.user_code, email
);
let login_expires_at = Instant::now() + std::time::Duration::from_secs(res.expires_in);