1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

tell the user what email they're using in auth

This commit is contained in:
mat 2022-11-27 16:29:30 -06:00
parent 631ed63dbd
commit 1a2178959d

View file

@ -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);