librespot-org / librespot

Open Source Spotify client library
MIT License
4.48k stars 542 forks source link

called `Result::unwrap()` on an `Err` value: AuthenticationError(LoginFailed(PremiumAccountRequired)) #1237

Closed thedtvn closed 6 months ago

thedtvn commented 6 months ago

Describe the bug I log in using freemium Account

To reproduce Steps to reproduce the behavior:

  1. use librespot in rust to connect
  2. using this code
    
    use librespot::{core::{session::Session, spotify_id::SpotifyId, config::SessionConfig, cache::Cache}, discovery::Credentials};

[tokio::main]

async fn main() {

let username = "...";
let password = "...";

let session_config = SessionConfig::default();

let credentials = Credentials::with_password(username, password);

let track = SpotifyId::from_base62("7M3iYY1TiF6D01rwxDz1ey").unwrap();   
let cache = Cache::new(Some("./credentials"), None, None, None).unwrap();
println!("Connecting...");
let (session, _credentials) = Session::connect(session_config, credentials, Some(cache), true).await.unwrap();
println!("Connected");

}

ver info

librespot = { version = "0.4.2" }


3. then run `cargo run`
4. See error
![image](https://github.com/librespot-org/librespot/assets/80153297/3562a2ae-a466-4742-b5eb-2467843c294c)

**Host (what you are running `librespot` on):**
- OS: Windows 11 preview
- Platform: Dell Laptop

**Additional context**
I has code some in java using
https://github.com/librespot-org/librespot-java
but it has no error like this
thedtvn commented 6 months ago

fixed by using

librespot = { git = "https://github.com/librespot-org/librespot"}