/// Prompt the user for its Spotify username and password
Prompt the user for its Spotify username and password
Prompt the user for its Spotify username and password
pub fn ask_user_credentials() -> Result<Credentials, std::io::Error> {
    // Username
    print!("Spotify username: ");
    std::io::stdout().flush()?;
    let mut username = String::new();
    std::io::stdin().read_line(&mut username)?;
    username = username.trim_end().to_string();
    // Password
    let password = rpassword::prompt_password(&format!("Password for {username}: "))?;
    Ok(Credentials {
        username,
        auth_type: AuthenticationType::AUTHENTICATION_USER_PASS,
        auth_data: password.as_bytes().into(),
    })
}
pub fn ask_user_credentials ( ) -> Result < Credentials , std :: io :: Error > { // Username print ! ( " " ) ; std :: io :: stdout ( ) . flush ( ) ? ; let mut username = String :: new ( ) ; std :: io :: stdin ( ) . read_line ( & mut username ) ? ; username = username . trim_end ( ) . to_string ( ) ; // Password let password = rpassword :: prompt_password ( & format ! ( " " ) ) ? ; Ok ( Credentials { username , auth_type : AuthenticationType :: AUTHENTICATION_USER_PASS , auth_data : password . as_bytes ( ) . into ( ) , } ) }
Prompt the user for its Spotify username and password
Prompt the user for its Spotify username and password