# Mopidy-Spotify as a service: Login problems

**URL:** <https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904>\
**Category:** Help and support\
**Created:** [April 24, 2021, 11:15am UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904 "2021-04-24T11:15:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorenz](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lorenz](https://discourse.mopidy.com/u/lorenz)\
**Post date:** [April 24, 2021, 11:15am UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/1 "2021-04-24T11:15:42Z")

</div>

Hello everyone,

I have installed Mopidy and Mopidy-Spotify on my Raspberry Pi 4. It works fine when I start it through the terminal. However, when starting it using systemctl Spotify can’t connect to my account. If I restart the service manually it works fine.

> Apr 24 11:58:35 raspberrypi mopidy[463]: ERROR [SpotifyEventLoop] spotify.session Spotify login error: \<ErrorType.OTHER\_PERMANENT: 10\>  
> Apr 24 11:58:37 raspberrypi mopidy[463]: ERROR [SpotifyBackend-6] mopidy\_spotify.web OAuth token refresh failed: Unknown error.  
> Apr 24 11:58:37 raspberrypi mopidy[463]: ERROR [SpotifyBackend-6] mopidy\_spotify.web Failed to load Spotify user profile

I’ve read in [this thread](https://discourse.mopidy.com/t/fixed-spotify-login-error-and-no-gpio-when-mopidy-as-service/1248/2) that I should change the daemon user from mopidy to root. I’m not sure if this is the same problem. Can you please tell me how to change the daemon user? Is there anything else to solve my problem?

Thank you very much for any help!

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 24, 2021, 1:36pm UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/2 "2021-04-24T13:36:47Z")

</div>

Hi, please do not change the user. Is almost never, ever, ever the actual solution.

The normal way to run Mopidy is documented at [Running as a service — Mopidy 3.1.1-1-gf17acacf documentation](https://docs.mopidy.com/en/latest/running/service/) and you can use the commands `sudo mopidyctl config` and `sudo mopidyctl deps` to provide debugging info here. Use those commands to ensure you’ve correctly populated the Mopidy-Spotify config settings.

Is there definitely full Internet connectivity at the point Mopidy is starting? If you restart the Mopidy service (command in the docs) do you get the same errors?

---

<div class="post-metadata">

**Author:** ![lorenz](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lorenz](https://discourse.mopidy.com/u/lorenz)\
**Post date:** [April 24, 2021, 3:26pm UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/3 "2021-04-24T15:26:59Z")

</div>

Hi, thanks a lot for your quick reply. I guess I should have sent the config rightaway.

I used your documentation to setup the Mopidy service. If I restart the service manually it is working fine. How can I make sure to have full internet connection when Mopidy starts?

> [core]  
> cache\_dir = /var/cache/mopidy  
> config\_dir = /etc/mopidy  
> data\_dir = /var/lib/mopidy  
> max\_tracklist\_length = 10000  
> restore\_state = false
> 
> [logging]  
> verbosity = 0  
> format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s  
> color = false  
> config\_file =
> 
> [audio]  
> mixer = software  
> mixer\_volume =  
> output = pulsesink server=127.0.0.1  
> buffer\_time =
> 
> [proxy]  
> scheme =  
> hostname =  
> port =  
> username =  
> password =
> 
> [musicbox\_webclient]  
> enabled = true  
> musicbox = false  
> websocket\_host =  
> websocket\_port =  
> on\_track\_click = PLAY\_ALL
> 
> [mpd]  
> enabled = true  
> hostname = ::  
> port = 6600  
> password =  
> max\_connections = 20  
> connection\_timeout = 60  
> zeroconf = Mopidy MPD server on $hostname  
> command\_blacklist =  
> listall  
> listallinfo  
> default\_playlist\_scheme = m3u
> 
> [file]  
> enabled = true  
> media\_dirs =  
> $XDG\_MUSIC\_DIR|Music  
> ~/|Home  
> excluded\_file\_extensions =  
> .directory  
> .html  
> .jpeg  
> .jpg  
> .log  
> .nfo  
> .pdf  
> .png  
> .txt  
> .zip  
> show\_dotfiles = false  
> follow\_symlinks = false  
> metadata\_timeout = 1000
> 
> [http]  
> enabled = true  
> hostname = 127.0.0.1  
> port = 6680  
> zeroconf = Mopidy HTTP server on $hostname  
> allowed\_origins =  
> csrf\_protection = true  
> default\_app = mopidy
> 
> [m3u]  
> enabled = true  
> base\_dir =  
> default\_encoding = latin-1  
> default\_extension = .m3u8  
> playlists\_dir =
> 
> [softwaremixer]  
> enabled = true
> 
> [stream]  
> enabled = true  
> protocols =  
> http  
> https  
> mms  
> rtmp  
> rtmps  
> rtsp  
> metadata\_blacklist =  
> timeout = 5000
> 
> [spotify]  
> enabled = true  
> username = \*\*\*\*\*\*\*\*  
> password = \*\*\*\*\*\*\*\*  
> client\_id = \*\*\*\*\*\*\*\*  
> client\_secret = \*\*\*\*\*\*\*\*  
> bitrate = 160  
> volume\_normalization = true  
> private\_session = false  
> timeout = 10  
> allow\_cache = true  
> allow\_network = true  
> allow\_playlists = true  
> search\_album\_count = 20  
> search\_artist\_count = 10  
> search\_track\_count = 50  
> toplist\_countries =

> Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps” as user mopidy  
> Executable: /usr/bin/mopidy  
> Platform: Linux-5.10.17-v7l±armv7l-with-debian-10.9  
> Python: CPython 3.7.3 from /usr/lib/python3.7  
> Mopidy: 3.1.1 from /usr/lib/python3/dist-packages  
> Mopidy-Spotify: 4.1.0 from /usr/lib/python3/dist-packages  
> Mopidy-MusicBox-Webclient: 3.1.0 from /usr/local/lib/python3.7/dist-packages  
> Mopidy: 3.1.1 from /usr/lib/python3/dist-packages  
> Pykka: 2.0.3 from /usr/lib/python3/dist-packages  
> setuptools: 40.8.0 from /usr/lib/python3/dist-packages  
> Mopidy-MPD: 3.1.0 from /usr/local/lib/python3.7/dist-packages  
> Mopidy: 3.1.1 from /usr/lib/python3/dist-packages  
> Pykka: 2.0.3 from /usr/lib/python3/dist-packages  
> setuptools: 40.8.0 from /usr/lib/python3/dist-packages  
> GStreamer: 1.14.4.0 from /usr/lib/python3/dist-packages/gi  
> Detailed information:  
> Python wrapper: python-gi 3.30.4  
> 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

---

<div class="post-metadata">

**Author:** ![jjok](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jjok/32/448_2.png) [@jjok](https://discourse.mopidy.com/u/jjok)\
**Post date:** [April 25, 2021, 9:43pm UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/4 "2021-04-25T21:43:34Z")

</div>

What operating system are you using? If it’s Raspberry Pi OS, there’s a “Wait for network” option in `raspi-config`.

---

<div class="post-metadata">

**Author:** ![lorenz](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lorenz](https://discourse.mopidy.com/u/lorenz)\
**Post date:** [April 27, 2021, 3:37pm UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/5 "2021-04-27T15:37:11Z")

</div>

Thank you so much!! That was really all it took.

---

<div class="post-metadata">

**Author:** ![lorenz](https://avatars.discourse-cdn.com/v4/letter/l/9d8465/32.png) [@lorenz](https://discourse.mopidy.com/u/lorenz)\
**Post date:** [April 27, 2021, 4:00pm UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/6 "2021-04-27T16:00:44Z")

</div>

Another question: I’m using pulseaudio-dlna to stream from Mopidy to my speaker. Is there any way to make the speaker’s control buttons (play/pause etc.) work together with Mopidy?

If there isn’t one for DLNA, how can I do it with bluetooth?

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [October 27, 2021, 4:00am UTC](https://discourse.mopidy.com/t/mopidy-spotify-as-a-service-login-problems/4904/7 "2021-10-27T04:00:56Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
