Open holzotto opened 1 month ago
Same problem. Funny thing is that I can login to my main account with username or password without issue, but my burner account (premium) is a non-starter.
23:57:32> zotify -f
Username: ****
Password: ****
Traceback (most recent call last):
File "
It seems like I've identified the issue. I was experiencing the same problem as you.
However, after I switched the proxy IP to the region where my account is registered, everything worked fine, and I was able to log in.
For instance, my account is registered in the Philippines. Initially, I was using a U.S. proxy IP, which allowed me to log in and use the browser, but I couldn't log in to Zotify.
After switching to a proxy IP from the Philippines, Zotify worked perfectly.
Hey @daydaya hope you are doing well!
Can I ask how you changed IP regions to force login elsewhere?
Hey @daydaya hope you are doing well!
Can I ask how you changed IP regions to force login elsewhere?
The software I used is Clash , but basically, you can use any VPN for this purpose
same issue here but my account is based in Germany and I am accessing also with a German IP address. I assume spotify change something
same issue here but my account is based in Germany and I am accessing also with a German IP address. I assume spotify change something
same here my acc is in Greece and i am in greece with a greek ip and everithing but still dosent work i conected with a vpn that i have here in greece but still nothing
I was forced to reset my spotify account password. Somehow this behaviour is in general weird ...
I was able to get Zotify working again by:
credentials.json
: https://github.com/librespot-org/librespot/issues/1308#issuecomment-2294947853credentials.json
as follows before placing it where Zotify looks for it:
"auth_type": 1
with "type":"AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
"auth_data"
to "credentials"
Unfortunately you need a premium account for step 1 (not sure if this can be worked around).
I was able to get Zotify working again by:
- Use this script to generate a
credentials.json
: Authentication failures librespot-org/librespot#1308 (comment)Modify the
credentials.json
as follows before placing it where Zotify looks for it:
- Replace
"auth_type": 1
with"type":"AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
- Rename
"auth_data"
to"credentials"
Unfortunately you need a premium account for step 1 (not sure if this can be worked around).
I was just fiddling around with that same script - this worked like a charm! Thanks @ImranR98
I was able to get Zotify working again by:
- Use this script to generate a
credentials.json
: Authentication failures librespot-org/librespot#1308 (comment)Modify the
credentials.json
as follows before placing it where Zotify looks for it:
- Replace
"auth_type": 1
with"type":"AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
- Rename
"auth_data"
to"credentials"
Unfortunately you need a premium account for step 1 (not sure if this can be worked around).
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows: Install Rust from https://www.rust-lang.org/tools/install
Open Windows Powershell and type: git clone https://github.com/librespot-org/librespot.git cd librespot-auth cargo build
You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell.
It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows: Install Rust from https://www.rust-lang.org/tools/install
Open Windows Powershell and type: git clone https://github.com/librespot-org/librespot.git cd librespot-auth cargo build
You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell.
It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
Could you help me with the same for Mac? I used brew install librespot
and not sure what the next steps are...
I was able to get Zotify working again by:
- Use this script to generate a
credentials.json
: Authentication failures librespot-org/librespot#1308 (comment)Modify the
credentials.json
as follows before placing it where Zotify looks for it:
- Replace
"auth_type": 1
with"type":"AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
- Rename
"auth_data"
to"credentials"
Unfortunately you need a premium account for step 1 (not sure if this can be worked around).
I tried this method and ran into the issue of it requiring Premium. However, not sure if it was a fluke, but I just replaced the DeviceType::SPEAKER
in the script (src/main.rs: line 46) with DeviceType::COMPUTER
and it worked. Maybe this will also work for other non-premium users.
Hopefully this can be worked on so we can login w/o having to install 6GB worth of dependencies (required for Rust)
Hopefully this can be worked on so we can login w/o having to install 6GB worth of dependencies (required for Rust)
1.72GB is not that bad
FROM rust:1.80-slim-bullseye
WORKDIR /app
COPY . .
RUN cargo build --release
EXPOSE 40801/tcp
EXPOSE 5353/udp
ENTRYPOINT ["/app/target/release/librespot-auth"]
I was able to get Zotify working again by:
- Use this script to generate a
credentials.json
: Authentication failures librespot-org/librespot#1308 (comment)Modify the
credentials.json
as follows before placing it where Zotify looks for it:
- Replace
"auth_type": 1
with"type":"AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
- Rename
"auth_data"
to"credentials"
Unfortunately you need a premium account for step 1 (not sure if this can be worked around).
I tried this method and ran into the issue of it requiring Premium. However, not sure if it was a fluke, but I just replaced the
DeviceType::SPEAKER
in the script (src/main.rs: line 46) withDeviceType::COMPUTER
and it worked. Maybe this will also work for other non-premium users.
When setting the value to .device_type(DeviceType::Computer), it didn’t work for non-premium users. I don’t have much experience with Rust or Spotify, but I was able to find a workaround with the help of ChatGPT.
Here is my modified script:
use clap::Parser;
use futures::StreamExt;
use librespot_core::authentication::Credentials;
use librespot_core::SessionConfig;
use librespot_discovery::{DeviceType, Discovery};
use sha1::{Digest, Sha1};
use serde_json;
use std::fs::File;
use std::io::Write;
use std::process::exit;
use log::warn;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(short, long, default_value = "Generate Credentials")]
name: String,
#[arg(short, long, default_value = "credentials.json")]
path: String,
}
pub fn save_credentials_and_exit(location: &str, cred: &Credentials) {
let result = File::create(location).and_then(|mut file| {
let data = serde_json::to_string(cred)?;
write!(file, "{data}")
});
if let Err(e) = result {
warn!("Cannot save credentials to cache: {}", e);
exit(1);
} else {
println!("Credentials saved: {}", location);
exit(0);
}
}
#[tokio::main(flavor = "current_thread")]
async fn main() {
let args = Args::parse();
let name = args.name;
let credentials_location = args.path;
let device_id = hex::encode(Sha1::digest(name.clone().as_bytes()));
let mut server = Discovery::builder(device_id.clone(), SessionConfig::default().client_id)
.name(name.clone()) // Custom device name from args
.device_type(DeviceType::Computer) // Closest to a web player
.launch()
.unwrap();
println!("Open Spotify and select the output device: Generate Credentials");
while let Some(credentials) = server.next().await {
save_credentials_and_exit(&credentials_location, &credentials);
}
}
To use this:
Compile the script. Run it. Note: Don’t use a VPN while trying this. Open both the web player and the Spotify application. In the Spotify application, choose the device labeled "Generate Credentials." This will generate a credentials.json file.
Before using the generated credentials.json with Zotify, modify it as follows:
Replace "auth_type": 1 with "type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS". Rename "auth_data" to "credentials". After making these changes, you should be good to go.
I also made music player with lrc support. Please check it out. https://github.com/amm926616/April-Music-Player
is anyone using this workaround with docker? seems like prior I have to set up spotifyd.
I used a windows machine to create my credentials.json but what's next ?
tried like in the description to define the path of my credentials.json file unfortunately I do se a json error. My file is correctly formatted. I‘m out of ideas and would like to get this working.
Same errors on the zotify windows installation.
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows:
Install Rust from https://www.rust-lang.org/tools/install
Open Windows Powershell and type:
git clone https://github.com/librespot-org/librespot.git
cd librespot-auth
cargo build
You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell.
It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
If you don't mind me asking, is the credentials.json the same across devices? So if I follow this guide on my pc can I use the same file on my mac?
I need help as I am not able to proceed further. How to link now that credentials file with zotify? I valided the json file an formatting is also ok, tried later on with a fresh file by just replacing auth type etc. as suggested.
I need help as I am not able to proceed further. How to link now that credentials file with zotify? I valided the json file an formatting is also ok, tried later on with a fresh file by just replacing auth type etc. as suggested.
I am having this issue as well, using windows 10
I need help as I am not able to proceed further. How to link now that credentials file with zotify? I valided the json file an formatting is also ok, tried later on with a fresh file by just replacing auth type etc. as suggested.
I am having this issue as well, using windows 10
I managed to solve this.
"CREDENTIALS_LOCATION": "C:\Users\user\AppData\Roaming\Zotify\credentials.json",
thats how you need to set the path to your file.
unfortunately I am not a windows user and this is just a workaround. Still struggling to set this up under my docker environment.
I need help as I am not able to proceed further. How to link now that credentials file with zotify? I valided the json file an formatting is also ok, tried later on with a fresh file by just replacing auth type etc. as suggested.
Make sure to use double \ instead of single \ for the location. Took me almost two hours to realise that.
P.S. Visual Studio code automatically does that if you just copy and paste. And I kept typing the directory manually only to keep making that silly mistake.
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows: Install Rust from https://www.rust-lang.org/tools/install
Open Windows Powershell and type: git clone https://github.com/librespot-org/librespot.git cd librespot-auth cargo build
You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell.
It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
Also a nooby here, I followed your instructions but after pasting "cd librespot-auth" it says it cannot find it:
cd : Cannot find path 'C:\Users\xxxx\librespot-auth' because it does not exist. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (C:\Users\xxxx\
librespot-auth:String) [Set-Location], ItemNotFoundExcepti
on
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShel
l.Commands.SetLocationCommand
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows: Install Rust from https://www.rust-lang.org/tools/install Open Windows Powershell and type: git clone https://github.com/librespot-org/librespot.git cd librespot-auth cargo build You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell. It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
Also a nooby here, I followed your instructions but after pasting "cd librespot-auth" it says it cannot find it:
cd : Cannot find path 'C:\Users\xxxx\librespot-auth' because it does not exist. At line:1 char:1
- cd librespot-auth
+ CategoryInfo : ObjectNotFound: (C:\Users\xxxx\ librespot-auth:String) [Set-Location], ItemNotFoundExcepti on + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShel l.Commands.SetLocationCommand
Their steps skipped downloading librespot-auth. I used this command: git clone https://github.com/dspearson/librespot-auth.git
To all, I wasn't able to generate credentials until I actually played something in Spotify. Seems obvious in retrospect, but I hadn't thought to simply press play.
Do we have a fix for this issue, or are we stuck on the workaround. My premium is expiring soon, this info will help me decide how long to wait.
Sorry for asking, but how can i use the first script? I am a nooby, but i get the installation of zotify. But is the first script just possible without linux? Don't find a way how to do it. Thank you! :)
Assuming you're on Windows: Install Rust from https://www.rust-lang.org/tools/install Open Windows Powershell and type: git clone https://github.com/librespot-org/librespot.git cd librespot-auth cargo build You should now have a librespot-auth.exe file in the librespot-auth/target/debug/ folder. Run it inside the powershell. It'll prompt you to "Open Spotify and select output device: Speaker", meaning click on the speaker icon next to the volume slider and connect to the "Speaker" device. It won't work without Spotify Premium.
Also a nooby here, I followed your instructions but after pasting "cd librespot-auth" it says it cannot find it: cd : Cannot find path 'C:\Users\xxxx\librespot-auth' because it does not exist. At line:1 char:1
- cd librespot-auth
+ CategoryInfo : ObjectNotFound: (C:\Users\xxxx\ librespot-auth:String) [Set-Location], ItemNotFoundExcepti on + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShel l.Commands.SetLocationCommand
Their steps skipped downloading librespot-auth. I used this command:
git clone https://github.com/dspearson/librespot-auth.git
To all, I wasn't able to generate credentials until I actually played something in Spotify. Seems obvious in retrospect, but I hadn't thought to simply press play.
It worked! Thanks for explaining!
I wish, anyone could share the setup for Linux. I can’t find the config.json to point to my generated credentials.json.
I wish, anyone could share the setup for Linux. I can’t find the config.json to point to my generated credentials.json.
config.json is in /home/YOUR_USER/.config/zotify/config.json
anyway, I have generated the credentials.json and modified it as indicated in the comment above and zotify keeps asking for credentials...
Okay I think i tried everything properly but still getting this error
Traceback (most recent call last):
File "[Python path]\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "[Python path]\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "[Python path]\Scripts\zotify.exe\__main__.py", line 7, in <module>
File "[Python path]\site-packages\zotify\__main__.py", line 64, in main
args.func(args)
File "[Python path]\site-packages\zotify\app.py", line 21, in client
Zotify(args)
File "[Python path]\site-packages\zotify\zotify.py", line 21, in __init__
Zotify.login(args)
File "[Python path]\site-packages\zotify\zotify.py", line 32, in login
cls.SESSION = Session.Builder(conf).stored_file(cred_location).create()
File "[Python path]\site-packages\librespot\core.py", line 1589, in stored_file
typ=Authentication.AuthenticationType.Value(
File "[Python path]\site-packages\google\protobuf\internal\enum_type_wrapper.py", line 82, in Value
raise ValueError('Enum {} has no value defined for name {!r}'.format(
ValueError: Enum AuthenticationType has no value defined for name 1
can confirm my creds are being fed in as if I change filename it defaults to asking me for creds
{"username": "INSERTUSERNAMEHERE", "credentials": "INSERT CREDENTIALS HERE", "type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"}
This is how i formatted my credentials.json to get it working. If anyone else is willing to give it a try and see if it works, that would be awesome.
{"username": "ENTERUSERNAMEOBTAINEDFROM LIBRESPOTAUTH HERE", "credentials": "INSERTCREDENTIALSSTRINGOBTAINEDFROM LIBRESPOTAUTH HERE", "type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"}
This is how i formatted my credentials.json to get it working. If anyone else is willing to give it a try and see if it works, that would be awesome.
Yep that's what I did below is mine with info removed
{
"username": "82teogm",
"credentials": "QVJubWxFMmhwbWRfNmVGNTZLN1lUZHdzZFI3eVVOQ1I0Tm11V18yM3VNaENmREFHOVpCeXFTX1ZsLXM4azZNTXdVS2VxYkg4a1EzLTNvV0F3U3h3U19qVTVrUEYyQTk5UjQxX00ydmlFYkNmWXBQWkljVUN6QkdwRlJBRk42S0UyZHNKRnh1WHQxWUtwdEVqeGpfUWlFZEpaLTFkb0E4YnRJSlp4WnJsRg==",
"type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"
}
I need help as I am not able to proceed further. How to link now that credentials file with zotify? I valided the json file an formatting is also ok, tried later on with a fresh file by just replacing auth type etc. as suggested.
I am having this issue as well, using windows 10
I managed to solve this.
"CREDENTIALS_LOCATION": "C:\Users\user\AppData\Roaming\Zotify\credentials.json",
thats how you need to set the path to your file.
unfortunately I am not a windows user and this is just a workaround. Still struggling to set this up under my docker environment.
what is the format of your cred file?
How can I set the path to credentials.json if I am running Zotify inside Docker?
this works also in docker
how to authenticate using the new oauth way:
install git, rust and cargo, download the following branch of librespot https://github.com/kingosticks/librespot/tree/credentials_with_access_token
run branch using:
cargo run --no-default-features -- --cache . --token ""
you'll need to open a link and let it redirect to the local librespot webservice.
if everything went well you end up with a credentials.json
in the directory, which looks like this:
{
"username": "QWERQWERQWERQWER",
"auth_type": 1,
"auth_data": "ASDFASDFASDF"
}
change it to look like the follwing:
{
"username": "QWERQWERQWERQWER",
"type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS",
"credentials": "ASDFASDFASDF"
}
and you're done - don't forget to refrence the credentials.json in you zotify/config.json
did all this and is still asking for credentials,
use --credentials-location when you have your new credentials.json works like a charm. Thank you for the script and the manual
command =f"zotify --username \"{username_spotify}\" --password \"{pwd_spotify}\"
--credentials-location \"{credentials_path}\"
--download-format \"mp3\" --root-path \"{root_path_music}\" --download-quality \"very_high\" --song-archive \"archive\" --download-lyrics \"false\" \"{playlist_uri}\""
If you use docker, definitely try --credentials-location
. I was just setting -e CREDENTIALS_LOCATION
in the docker run invocation, but that didn't seem to have an effect.
im having a very hard time following any of this the comments are kind of a mess
Tried logging in with username, email and changing my password. Even deleting the credentials file didn’t help.