Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotify disabled username/password authentication #394

Closed
kingosticks opened this issue Aug 13, 2024 · 50 comments
Closed

Spotify disabled username/password authentication #394

kingosticks opened this issue Aug 13, 2024 · 50 comments
Labels
A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot)

Comments

@kingosticks
Copy link
Member

kingosticks commented Aug 13, 2024

Fixed in the latest pre-release and forked version of gst-plugin-spotify. Read all of the README for details.


noting that Spotify disabled username/password authentication, which affects playback in 2024 on the https://github.com/mopidy/mopidy-spotify/tree/v5.0.0alpha branch,

users will see errors similiar to failed to start: Login failed with reason: Bad credentials

ERROR        spotifyaudiosrc audio/spotify/src/spotifyaudiosrc/imp.rs:328:gstspotify::spotifyaudiosrc::imp:<source> failed to start: Login failed with reason: Bad credentials
WARN                 basesrc gstbasesrc.c:3134:gst_base_src_loop:<source> error: Internal data stream error.
WARN                 basesrc gstbasesrc.c:3134:gst_base_src_loop:<source> error: streaming stopped, reason error (-5)
WARN                oggdemux gstoggdemux.c:4775:gst_ogg_demux_send_event:<oggdemux0> error: EOS before finding a chain
WARN                oggdemux gstoggdemux.c:2550:gst_ogg_demux_sink_event:<oggdemux0> EOS while trying to retrieve chain, seeking disabled

since this is an upstream issue with librespot-org/librespot#1308 a solution will be multi-tiered,

as always, ty @kingosticks, for your work on this

Originally posted by @troyxmccall in #110 (comment)


Thanks for adding this here also.

I would have thought things will continue to work for existing users because we support "cached credentials". Only the very first login actually uses your user and password. This does assume you are persisting the contents of Mopidy's data_dir where we store that blob. The default config location should ensure that's the case. I can replicate the problem if I move my cached creds elsewhere but it's still working otherwise.

Obtaining cached credentials (via a custom build of librespot, or similar) and moving them into this directory is a work-around.

Originally posted by @kingosticks in #110 (comment)

@kingosticks kingosticks added the A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot) label Aug 13, 2024
@kingosticks
Copy link
Member Author

kingosticks commented Aug 13, 2024

As already mentioned, this ultimately needs fixing in librespot. I have submitted a PR there to do that, hopefully it'll be merged when the maintainer has time. I'd appreciate review/feedback anyone has on that work but please don't hassle them there, everyone is busy and it's holiday season too - thanks Spotify! Once that (or something like it) is merged, we'll need to get support into gst-plugin-spotify. Depending what that support looks like, we may then also need to make changes to Mopidy-Spotify. As you can see, there are multiple projects involved so don't expect this to happen tomorrow. We could provide a custom build but I am reluctant because I'm not sure what gst-plugin-spotify will look like and I don't want to support another version of everything, even if it is short-term.

In the meantime, there is a workaround. You ultimately need to obtain a "cached credentials" file and drop this into your Mopidy-Spotify data directory (typically $HOME/.local/share/mopidy/spotify/credentials-cache/credentials.json or /var/lib/mopidy/spotify/credentials-cache/credentials.json). You can generate this file by running librespot and authenticating via "discovery" mode (AKA zeroconf).

  1. Download rust and clone librespot.
  2. From the librespot directory do cargo run --no-default-features -- --cache .
  3. Use an official Spotify app (on the same network) to connect to the running librespot device using Spotify Connect
  4. You'll then find a new credentials.json file in the librespot directory that looks something like
{"username":"fred","auth_type":1,"auth_data":"LOADOFSEEMINGLYRANDOMCHARACTERSBLAHBLAGBWOOTWOOt=="}
  1. Copy this file into the appropriate Mopidy-Spotify directory as mentioned above.

If you cannot use Spotify Connect for whatever reason, you can alternatively get a credentials.json file using the new OAuth flow feature in the dev librespot branch: cargo run --no-default-features -- --cache . --enable-oauth.

@kingosticks kingosticks pinned this issue Aug 13, 2024
@phuketbinaryt
Copy link

As already mentioned, this ultimately needs fixing in librespot. I have submitted a PR there to do that, hopefully it'll be merged when the maintainer has time. I'd appreciate review/feedback anyone has on that work but please don't hassle them there, everyone is busy and it's holiday season too - thanks Spotify! Once that (or something like it) is merged, we'll need to get support into gst-plugin-spotify. Depending what that support looks like, we may then also need to make changes to Mopidy-Spotify. As you can see, there are multiple projects involved so don't expect this to happen tomorrow. We could provide a custom build but I am reluctant because I'm not sure what gst-plugin-spotify will look like and I don't want to support another version of everything, even if it is short-term.

In the meantime, there is a workaround. You ultimately need to obtain a "cached credentials" file and drop this into your Mopidy-Spotify data directory (typically $HOME/.local/share/mopidy/spotify/credentials-cache/credentials.json or /var/lib/mopidy/spotify/credentials-cache/credentials.json). You can generate this file by running librespot and authenticating via "discovery" mode (AKA zeroconf).

  1. Download rust and clone librespot.
  2. From the librespot directory do cargo run --no-default-features -- --cache .
  3. Use an official Spotify app (on the same network) to connect to the running librespot device using Spotify Connect
  4. You'll then find a new credentials.json file in the librespot directory that looks something like
{"username":"fred","auth_type":1,"auth_data":"LOADOFSEEMINGLYRANDOMCHARACTERSBLAHBLAGBWOOTWOOt=="}
  1. Copy this file into the appropriate Mopidy-Spotify directory as mentioned above.

If you cannot use Spotify Connect for whatever reason, you could clone my librespot branch instead and get your credentials.json via the new OAuth flow with cargo run --no-default-features -- --cache . --token ''.

I am getting this error when trying the last option:
Error parsing command line options: Unrecognized option: 'token'

@kingosticks
Copy link
Member Author

kingosticks commented Aug 13, 2024

Does 'token' appear as an option when you run with --help? If not, you're not using my fork. Also note the version should be '0.5.0-dev 27b2b59'.

cargo run --no-default-features -- -c . --help
...
librespot 0.5.0-dev 27b2b59 (Built on 2024-08-13, Build ID: 2q9wcmIs, Profile: debug)

An open source client library for Spotify, with support for Spotify Connect

https://github.com/librespot-org/librespot

Usage: target\debug\librespot.exe [<Options>]

Options:
...
    -k, --token TOKEN   Spotify access token to sign in with. Use empty string
                        to obtain token.

@phuketbinaryt
Copy link

Looks like cloning the git was giving me the wrong version indeed. Grabbed the zip and that sorted it all out. Thanks, working great now.

@pvincent4
Copy link

Thanks a lot for this quick fix.
Surprisingly it worked well yesterday adding manualy the credentials.json to my local folder... but today I get this error starting mopidy and its extensions :
pi mopidy[13812]: ERROR [SpotifyBackend-9] mopidy_spotify.web OAuth token refresh failed: invalid_grant Grant has been revoked.
pi mopidy[13812]: ERROR [SpotifyBackend-9] mopidy_spotify.web Failed to load Spotify user profile

I retried the procedure without success, a bit weird... Is somebody experiencing a similar issue?

PS : I guessed that values ​in mopidy.conf ​are not supposed to be removed (username, password, client_id, client_secret)

@kingosticks
Copy link
Member Author

PS : I guessed that values ​in mopidy.conf ​are not supposed to be removed (username, password, client_id, client_secret)

The username and password fields won't actually be used once you've got a credentials.json in place. The client_id and client_secret might need updating if Spotify have reset your credentials? These are used by the mopidy_spotify.web module to access your account data. You can get new ones at https://mopidy.com/ext/spotify/

@geheim27
Copy link

Hi,
I tried the Spotify Connect workaround but unfortunately without success. Is there any log entry to verify the use of the credentials.json file by Mopidy?
Thanks

@kingosticks
Copy link
Member Author

No. You could try the gstreamer logs: GST_DEBUG=3,*spotify*:6 mopidy.

@pvincent4
Copy link

pvincent4 commented Aug 15, 2024

The username and password fields won't actually be used once you've got a credentials.json in place. The client_id and client_secret might need updating if Spotify have reset your credentials? These are used by the mopidy_spotify.web module to access your account data. You can get new ones at https://mopidy.com/ext/spotify/

Well done, I reset the values ​​and that fixed the problem. Cheers

@geheim27
Copy link

Found my problem. Within mopidy.conf, I had the spotify login mail address but credentials.json contained the spotify username. Updated mopidy.conf and now its working.

@kingosticks
Copy link
Member Author

Oh, excellent find. Thanks

@davestroker
Copy link

Thanks @kingosticks for your work. Unfortunatly i can not get it to work. I created the credentials.json on a windows machine and copied it to a linked folder on my server, where mopidy runs in a docker container.
I also did an update of the clientID and secret. It still gives me the "bad credentials" error. Is it even possible to create the credentials on another machine or does it need to be the machine were mopidy runs? I gues then its not possible to do it within the container!? Thanks a lot!!!

@kingosticks
Copy link
Member Author

kingosticks commented Aug 18, 2024

I would guess it might need to be the same OS (e.g. windows, mac, Linux), because the client ID used to generate the credentials file is OS-specific. But that's a guess.

@kingosticks
Copy link
Member Author

kingosticks commented Aug 18, 2024

As per my early comment with workarounds, if you can't use zeroconf on your server, use my forked version and do the oauth flow in headless mode cargo run --no-default-features -- --cache . --token "" --token-port 0.

@3052
Copy link

3052 commented Aug 31, 2024

Spotify disabled username/password authentication

no, they didn't. you just have to specify user-agent

@kingosticks
Copy link
Member Author

Great, thanks, that's super helpful.

@PureTryOut
Copy link

So steps for me to make this work were a combination of multiple things mentioned in this thread:

  1. get a new valid credentials.json using LibreSpot when connecting to it from an official Spotify client
  2. Update client_id and client_secret values from https://mopidy.com/ext/spotify/
  3. Update the username field in mopidy.conf from my email address to the username mentioned in credentials.json. It seems to be an auto-generated username, there is no way I would be able to guess or know it

I hope this process can be simplified again at some point in the future because this was a bit of a hassle 😅

@powellc
Copy link

powellc commented Sep 20, 2024

Hmm, has anyone else encountered Spotify flagging the mopidy connection as suspicious and resetting their password? The first time this happened it took a while and I didn't associate it with this method. But yesterday Spotify locked my account down within about 8 hours of setting this up. I'll try again, but am now discouraged.

@kingosticks
Copy link
Member Author

It's happened to some users of librespot (and us by extension) because our software is still using their now deprecated username and password authentication flow. It's pretty stupid they're doing this (they gave us very little notice and didn't mention they'd also do this), but that's Spotify for you.... I've now got token based auth working but it relies on code that's not yet merged/released upstream. Hence it's slow. But it's coming and then we'll be able to remove the need for username and password entirely. Which is great for everyone.

Users that had working setups before should still be working because we've also been using "cached credentials", this login method is used in preference to user/pass auth. But I don't think it works for people with weird (Facebook) accounts where the username they log in with doesn't match their "real" Spotify username.

This entire mess is an effort by Spotify to increase account security and we're doing our best to catch up. Personally I have no idea why anyone would want to steal Spotify account credentials, presumably nobody is refusing their passwords in 2024... If you're worried about using your account with Mopidy-Spotify, all the software is available to view and you can build gst-plugin-spotify yourself from source. Spotify themselves are incapable of offering software like this for whatever internal reasons, we're incredibly lucky to have alternatives to their client. But all those alternative clients are based around unofficial software (librespot and its clones). I don't think Spotify intended to scare anyone away from using librespot. After all, they did proactively reach out to the project with a heads-up about the upcoming change. I think they just make a lot of mistakes.

@kingosticks
Copy link
Member Author

I should also add, cached credentials will also not work if you've managed to configure Mopidy incorrectly. There is currently zero checking and logging of cached credentials usage so it's not obvious when this is happening.

@powellc
Copy link

powellc commented Sep 20, 2024

Thanks for the quick reply @kingosticks ... my discouragement was not fear of using my account with Mopidy-Spotify, but bothering to keep this clunker running with mopidy at all. Also, I think you're right ... I definitely have an OG "weird" Facebook account ID for my username, so that very well may be part of the calculus here.

Thanks again for the help!

@The-Judge
Copy link

I'm also looking forward to this clear, non-username/password auth ... Phonieboxes are down now for over a year for me ...
I also have to add that this non-working auth mechanism comes with another unpleasant side-effect: The Account used for the Phoniebox gets locked each time the box boots up. Most certainly because the unsuccessfully auth is treated like some Brute-Force attack and account security kicks in.

@kingosticks
Copy link
Member Author

@alanmilinovic as I said earlier:

because our software is still using their now deprecated username and password authentication flow

The new version has that fixed. It'll be released soon.

@alanmilinovic
Copy link

@alanmilinovic as I said earlier:

because our software is still using their now deprecated username and password authentication flow

The new version has that fixed. It'll be released soon.

Very nice, happy to test it.

@kingosticks
Copy link
Member Author

Please put this in a separate issue. It does not belong here.

@The-Judge
Copy link

The-Judge commented Oct 6, 2024

I am very sorry to ask how to do all of this again, but I consider myself not being a complete IT-moron but yet, I can't get this to work, unfortunately.
I installed the Phoniebox v2 just as the docs say. No visible error experienced.

Since the librespot compile was missing these components, I then installed:

  • cmake
  • libclang-dev

Next, I Installed Rust and Cargo (defaults applied): curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh).

Using librespot commit 3781a089a69ce9883a299dfd191d90c9a5348819 (which has the fix from #1309), I then executed the non-spotify-connect variant: cargo run --no-default-features -- --cache . --enable-oauth and successfully created the credentials.json file.
Next, I stopped the cargo process (ctrl+c), created the path $HOME/.local/share/mopidy/spotify/credentials-cache and copied credentials.json there.

Finally, I restarted the Pi.
I heard the Phoniebox-chime and navigated to the Web-UI. Clicking on "Spotify", Iris asks me for that Client's Identifier, which I set and I'm lead to the Iris UI then.

Navigating to Settings > Spotify looks as if I'm not logged in yet and using the search causes JSON errors:

CleanShot 2024-10-06 at 16 55 10

What am I missing?
I don't even know which logs to provide ...

Doesn't that new librespot version need to be installed in addition to a good credentials.json file or something?

@troyxmccall
Copy link

@The-Judge happy to help you debug this if you move it over to: https://github.com/mopidy/mopidy-spotify/discussions/categories/q-a so we don't clog up this issue

@kingosticks
Copy link
Member Author

Fixed in Mopidy-Spotify v5.0.0a3 and gst-plugin-spotify_0.14.0~alpha.1-1.

@PureTryOut
Copy link

So how do you get this access token? Is that the auth_data property in credentials.json?
Although it complained about not having access-token (I didn't set it in the config because I don't yet understand where to get it from) an updated credentials.json seems to have worked 🤷 Note that I'm not yet using your version of gst-plugin-spotify, is that what I'm missing?

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/mopidy/audio/actor.py", line 577, in _on_source_setup
    self._source_setup_callback(source)
  File "/usr/lib/python3.12/site-packages/mopidy_spotify/backend.py", line 50, in on_source_setup
    source.set_property("access-token", self.backend._web_client.token())
TypeError: object of type `GstSpotifyAudioSrc' does not have property `access-token'

@kingosticks
Copy link
Member Author

kingosticks commented Oct 9, 2024

Note that I'm not yet using your version of gst-plugin-spotify, is that what I'm missing?

Bingo.

Although it complained about not having access-token (I didn't set it in the config because I don't yet understand where to get it from

You just need to setup everything as the readme states. If it required extra steps, I would provide them.

@PureTryOut
Copy link

Ah ok, thanks. I'll wait for a proper release of gst-plugin-spotify then 👍

@kingosticks
Copy link
Member Author

It's currently blocked waiting for the librespot v0.5 release. Which is only blocked by one PR - it's close!

@chiguire
Copy link

Thank you for providing the workaround! We did have to stop using the module for the moment, even with the workaround, because Spotify would disable the credentials by the next day, and it just became really annoying to reset the password each time we used the module. And until now we also had to provide the username and password because that's what the module used for searching.

@kingosticks
Copy link
Member Author

The workaround is no longer necessary. The latest pre-release is fixed. Follow the instructions in the readme, including deleting any credentials.json file you may have been using.

Username and password has only been required for playback for some time. We stopped using them for search approx 9 years ago. Now they're not required at all and I suggest removing them from your config.

@kingosticks
Copy link
Member Author

It's currently blocked waiting for the librespot v0.5 release. Which is only blocked by one PR - it's close!

@PureTryOut In case you didn't already see, librespot v0.5 has been released, and latest gst-plugins-rs now supports it.

@PureTryOut
Copy link

Latest gst-plugins-rs being 0.13.2? That's been released 4 weeks ago already, are you sure that uses the last librespot?

@kingosticks
Copy link
Member Author

No, latest code in their repo. They can't backport it to 0.13.x because it requires a newer rust version. I'm not sure when 0.14.0 is due for actual release, sorry.

@PureTryOut
Copy link

Ouch ok, a bit more waiting then!

@minilandl
Copy link

Still having a Similar issue to those who posted above do we need to wait for a fix.

audio/spotify/src/spotifyaudiosrc/imp.rs(280): <gstspotify::spotifyaudiosrc::imp::SpotifyAudioSrc as gstreamer_base::subclass::push_src::PushSrcImpl>::create (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstSpotifyAudioSrc:source:\nPermission denied { Login failed with reason: Bad credentials }'

I have created and added an access token in the mopidy config file

 [spotify]
client_id = 
client_secret = 
bitrate = 320
enabled=true
volume_normalization = true
 

And installed packages as listed here and in other issues playback is still not working
also installed the latest alpha version of mopidy-spotify



mediauser@JG-Media:~$ sudo dpkg -l | grep gst
ii  gir1.2-gst-plugins-base-1.0:amd64         1.22.0-3+deb12u2                     amd64        GObject introspection data for the GStreamer Plugins Base library
ii  gir1.2-gstreamer-1.0:amd64                1.22.0-2                             amd64        GObject introspection data for the GStreamer library
ii  gst-plugin-spotify                        0.14.0~alpha.1-1                     amd64        GStreamer Spotify Plugin
ii  gstreamer1.0-alsa:amd64                   1.22.0-3+deb12u2                     amd64        GStreamer plugin for ALSA
ii  gstreamer1.0-gl:amd64                     1.22.0-3+deb12u2                     amd64        GStreamer plugins for GL
ii  gstreamer1.0-gtk3:amd64                   1.22.0-5+deb12u1                     amd64        GStreamer plugin for GTK+3
ii  gstreamer1.0-libav:amd64                  1.22.0-2                             amd64        ffmpeg plugin for GStreamer
ii  gstreamer1.0-plugins-bad:amd64            1.22.0-4+deb12u5                     amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.0-plugins-base:amd64           1.22.0-3+deb12u2                     amd64        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-good:amd64           1.22.0-5+deb12u1                     amd64        GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-ugly:amd64           1.22.0-2+deb12u1                     amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.0-pulseaudio:amd64             1.22.0-5+deb12u1                     amd64        GStreamer plugin for PulseAudio (transitional package)
ii  gstreamer1.0-qt5:amd64                    1.22.0-5+deb12u1                     amd64        GStreamer plugin for Qt5
ii  gstreamer1.0-tools                        1.22.0-2                             amd64        Tools for use with GStreamer
ii  gstreamer1.0-x:amd64                      1.22.0-3+deb12u2                     amd64        GStreamer plugins for X11 and Pango
ii  libgstreamer-gl1.0-0:amd64                1.22.0-3+deb12u2                     amd64        GStreamer GL libraries
ii  libgstreamer-plugins-bad1.0-0:amd64       1.22.0-4+deb12u5                     amd64        GStreamer libraries from the "bad" set
ii  libgstreamer-plugins-base1.0-0:amd64      1.22.0-3+deb12u2                     amd64        GStreamer libraries from the "base" set
ii  libgstreamer1.0-0:amd64                   1.22.0-2                             amd64        Core GStreamer libraries and elements
ii  python3-gst-1.0                           1.22.0-2                             amd64        GStreamer GObject Introspection overrides for Python (Python 3)

@kingosticks
Copy link
Member Author

kingosticks commented Nov 24, 2024

Can you clarify what you mean when you say you created an access token?

Can you share a full Mopidy debug log, and Mopidy deps.

Everything should be working, assuming this is the latest version of Mopidy-Spotify from GitHub.

@minilandl
Copy link

Yeah it should work albums are loaded from spotify but arent able to be played .

I have created a token at https://mopidy.com/ext/spotify/

Mopidy Deps

mediauser@JG-Media:~$ mopidy deps
Executable: /home/mediauser/.local/bin/mopidy
Platform: Linux-6.1.0-27-amd64-x86_64-with-glibc2.36
Python: CPython 3.11.2 from /usr/lib/python3.11
Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  requests: 2.32.3 from /home/mediauser/.local/lib/python3.11/site-packages
    charset-normalizer: 3.4.0 from /home/mediauser/.local/lib/python3.11/site-packages
    idna: 3.10 from /home/mediauser/.local/lib/python3.11/site-packages
    urllib3: 2.2.3 from /home/mediauser/.local/lib/python3.11/site-packages
    certifi: 2024.8.30 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
  tornado: 6.4.1 from /home/mediauser/.local/lib/python3.11/site-packages
Mopidy-YouTube: 3.7 from /home/mediauser/.local/lib/python3.11/site-packages
  beautifulsoup4: 4.12.2 from /home/mediauser/.local/lib/python3.11/site-packages
    soupsieve: 2.5 from /home/mediauser/.local/lib/python3.11/site-packages
  cachetools: 5.3.3 from /home/mediauser/.local/lib/python3.11/site-packages
  Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  requests: 2.32.3 from /home/mediauser/.local/lib/python3.11/site-packages
    charset-normalizer: 3.4.0 from /home/mediauser/.local/lib/python3.11/site-packages
    idna: 3.10 from /home/mediauser/.local/lib/python3.11/site-packages
    urllib3: 2.2.3 from /home/mediauser/.local/lib/python3.11/site-packages
    certifi: 2024.8.30 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
Mopidy-TuneIn: 1.1.0 from /usr/lib/python3/dist-packages
Mopidy-Jellyfin: 1.0.5 from /home/mediauser/.local/lib/python3.11/site-packages
  Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  requests: 2.32.3 from /home/mediauser/.local/lib/python3.11/site-packages
    charset-normalizer: 3.4.0 from /home/mediauser/.local/lib/python3.11/site-packages
    idna: 3.10 from /home/mediauser/.local/lib/python3.11/site-packages
    urllib3: 2.2.3 from /home/mediauser/.local/lib/python3.11/site-packages
    certifi: 2024.8.30 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
  unidecode: 1.3.6 from /usr/lib/python3/dist-packages
  websocket-client: 1.8.0 from /home/mediauser/.local/lib/python3.11/site-packages
Mopidy-Iris: 3.69.3 from /home/mediauser/.local/lib/python3.11/site-packages
  Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
Mopidy-InternetArchive: 3.0.1 from /usr/lib/python3/dist-packages
Mopidy-MPD: 3.3.0 from /usr/lib/python3/dist-packages
Mopidy-Local: 3.2.1 from /usr/lib/python3/dist-packages
Mopidy-Subidy: 1.1.0 from /home/mediauser/.local/lib/python3.11/site-packages
  Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
  py-sonic: 1.0.1 from /home/mediauser/.local/lib/python3.11/site-packages
Mopidy-SoundCloud: 3.0.2 from /usr/lib/python3/dist-packages
Mopidy-SomaFM: 2.0.2 from /usr/lib/python3/dist-packages
Mopidy-Spotify: 5.0.0a3 from /home/mediauser/.local/lib/python3.11/site-packages
  Mopidy: 3.4.2 from /home/mediauser/.local/lib/python3.11/site-packages
  Pykka: 4.1.1 from /home/mediauser/.local/lib/python3.11/site-packages
  requests: 2.32.3 from /home/mediauser/.local/lib/python3.11/site-packages
    charset-normalizer: 3.4.0 from /home/mediauser/.local/lib/python3.11/site-packages
    idna: 3.10 from /home/mediauser/.local/lib/python3.11/site-packages
    urllib3: 2.2.3 from /home/mediauser/.local/lib/python3.11/site-packages
    certifi: 2024.8.30 from /home/mediauser/.local/lib/python3.11/site-packages
  setuptools: 75.5.0 from /home/mediauser/.local/lib/python3.11/site-packages
GStreamer: 1.22.0.0 from /usr/lib/python3/dist-packages/gi
  Detailed information:
    Python wrapper: python-gi 3.42.2
    Relevant elements:
      Found:
        uridecodebin
        souphttpsrc
        appsrc
        alsasink
        osssink
        oss4sink
        pulsesink
        id3demux
        id3v2mux
        lamemp3enc
        mpegaudioparse
        mpg123audiodec
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        flump3dec
        mad

Every Time I attempt to play music from spotify in the iris web client I get the below message


Nov 25 17:28:00 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:00,958 [194287:HttpServer] mopidy.http.handlers

Nov 25 17:28:00 JG-Media mopidy[194287]:   Received WebSocket message from 10.0.8.2: '{"method":"core.tracklist.get_next_tlid","params":{},"jsonrpc":"2.0","id":27}'

Nov 25 17:28:00 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:00,959 [194287:HttpServer] mopidy.http.handlers

Nov 25 17:28:00 JG-Media mopidy[194287]:   Sent WebSocket message to 10.0.8.2: '{"jsonrpc": "2.0", "id": 27, "result": 35}'

Nov 25 17:28:01 JG-Media mopidy[194287]: ERROR    2024-11-25 17:28:01,241 [194287:MainThread] mopidy.audio.gst

Nov 25 17:28:01 JG-Media mopidy[194287]:   GStreamer error: Could not get/set settings from/on resource.

Nov 25 17:28:01 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:01,241 [194287:MainThread] mopidy.audio.gst

Nov 25 17:28:01 JG-Media mopidy[194287]:   Got ERROR bus message: error=GLib.Error('Could not get/set settings from/on resource.', 'gst-resource-error-quark', 13) debug='audio/spotify/src/spotifyaudiosrc/imp.rs(280): <gstspotify::spotifyaudiosrc::imp::SpotifyAudioSrc as gstreamer_base::subclass::push_src::PushSrcImpl>::create (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin2/GstSpotifyAudioSrc:source:\nPermission denied { Login failed with reason: Bad credentials }'

Nov 25 17:28:01 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:01,244 [194287:MainThread] mopidy.audio.gst

Nov 25 17:28:01 JG-Media mopidy[194287]:   Changing state to GST_STATE_NULL: result=GST_STATE_CHANGE_SUCCESS

Nov 25 17:28:08 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:08,145 [194287:Thread-22 (_send_ping)] websocket

Nov 25 17:28:08 JG-Media mopidy[194287]:   Sending ping

Nov 25 17:28:18 JG-Media mopidy[194287]: DEBUG    2024-11-25 17:28:18,146 [194287:Threa


also when loading the library there are errors in the log about tracks not being playable


Nov 25 15:54:50 JG-Media mopidy[187230]: DEBUG    2024-11-25 15:54:50,668 [187230:Thread-13 (_refresh_tracks)] mopidy_spotify.translator

Nov 25 15:54:50 JG-Media mopidy[187230]:   'spotify:track:6MKtbXb5IQRj349Ni5y7eY' is not playable

Nov 25 15:54:50 JG-Media mopidy[187230]: DEBUG    2024-11-25 15:54:50,681 [187230:Thread-13 (_refresh_tracks)] mopidy_spotify.translator

Nov 25 15:54:50 JG-Media mopidy[187230]:   'spotify:track:0YHvqxZxo9tH4H5nWuk8NY' is not playable

@minilandl
Copy link

thanks looked like I needed to change the cache and data directory as explained in the below issue then playback worked as expected

#388

@kingosticks
Copy link
Member Author

Were the defaults not already correct or had you changed them for some reason?

@minilandl
Copy link

The Defaults were not correct and needed to be changed I dont remember changing them I changed this in /etc/mopidy.conf

-data_dir = $XDG_DATA_DIR/mopidy
+data_dir = /var/lib/mopidy

Then changed the following in this file and changed the cache directory now playback work because it couldn't write the credentials.cache file correctly. It was pretty cryptic to work out but its working now

[core]

cache_dir = /var/lib/mopidy/cache

config_dir = /etc/mopidy

data_dir = /var/lib/mopidy

@kingosticks
Copy link
Member Author

kingosticks commented Nov 25, 2024

Perhaps you made the change a long time ago, or some people try to re-use their non-service config (copied from their home directory) with the Mopidy service (using /etc/mopidy.conf). The two modes have different core section defaults and this results in things not working correctly.

There settings you have added there are not quite right. If you are using our Debian service, just delete the entire core section from /etc/mopidy.conf and use the defaults (automatically provided for you by contents of /usr/share/mopidy/conf.d/mopidy.conf). You can also see the correct values defined at https://docs.mopidy.com/stable/config/#core-section, hopefully this makes things less cryptic.

However, I do entirely agree the error messages in this version of the extension are useless. I need to do more to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spotifyaudiosrc Area: spotifyaudiosrc (GStreamer/librespot)
Projects
None yet
Development

No branches or pull requests