mopidy-spotify icon indicating copy to clipboard operation
mopidy-spotify copied to clipboard

Spotify login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6>

Open tuukkatoivonen opened this issue 7 years ago • 20 comments

I am getting these errors when I start Mopidy with the Spotify plugin enabled:

2018-11-06 22:04:17,795 ERROR [4440:SpotifyEventLoop] spotify.session: Spotify login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6> 2018-11-06 22:04:17,797 INFO [4440:SpotifyEventLoop] spotify.session: Spotify logged out

  • I have Spotify Premium account
  • It is not connected to Facebook
  • My username contains only lowercase English characters and underscore ("_"), 15 characters
  • My password contains only lower and uppercase English characters and numbers, 8 characters
  • I regenerated the client_id and client_secret to check they were copy-pasted correctly (unless I'm doing some systematic error here)
  • I have verified that sconsify works (which is using libspotify, proving the problem is not in libspotify)
  • I can actually see my Spotify playlist partially (but not completely!) with Spotify Web Browse.

Any ideas how to debug this? With search I haven't found anyone else having the same problem. Are there any simple clients for testing which would use pyspotify (to check whether problem is in it)? Should I try to close my Spotify account and create a new one?

tuukkatoivonen avatar Nov 07 '18 19:11 tuukkatoivonen

I had the same issue and it took some fiddling to solve it. Here are my steps to solve it:

  1. generate client-id & client-secret using https://www.mopidy.com/authenticate/
  2. Go to https://www.spotify.com/us/account/overview/ There you will see a menuentry called "username". Use that instead of your actual username. screenshot of where to find your username

Quoteme avatar Dec 12 '18 21:12 Quoteme

Bump, this information should be added to the README.

Evidlo avatar Jun 28 '19 07:06 Evidlo

A PR would be welcome.

kingosticks avatar Jun 28 '19 07:06 kingosticks

For the Facebook users coming here for an answer, you need a device password and a username. Not your facebook login/password! Go to https://www.spotify.com/au/account/set-device-password/ for your username (sequence of numbers) and to set a device password.

renatocribeiro avatar Nov 15 '19 10:11 renatocribeiro

@renavspainatal to clarify, is the username on that page different to the one at https://www.spotify.com/us/account/overview/ ?

kingosticks avatar Nov 15 '19 12:11 kingosticks

@kingosticks I think those who have a Facebook login don't even have the username under the overview tab (I don't). Screenshot from 2019-11-15 13-49-42

renatocribeiro avatar Nov 15 '19 12:11 renatocribeiro

Thanks. Makes sense. Similarly, since I don't have a facebook login, https://www.spotify.com/au/account/set-device-password/ redirects me to https://www.spotify.com/us/account/overview/ where I have a username field above the "Email" field in your picture.

Your advice is already present in the README but I guess it's easily missed, maybe I'll add another note to try and make it more obvious.

But this won't help the OP. @tuukkatoivonen, did you ever get to the bottom of this?

kingosticks avatar Nov 15 '19 13:11 kingosticks

I noticed that I have to add username and password too despite already using client id and secret.

adrhc avatar Nov 24 '21 08:11 adrhc

Providing both is a requirement. They are not orthogonal login methods. All four fields are documented in the readme as "You must provide this".

kingosticks avatar Nov 24 '21 11:11 kingosticks

Hi, I've tried with username and email too. I have successfully generated client_id and client_secret, but in logs is still ErrorType.BAD_USERNAME_OR_PASSWORD. If it can't login, how it refresh playlists ?

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Architecture Description
+++-==============-==============-============-================================================================
ii  mopidy         3.2.0-1        all          extensible music server
un  mopidy-doc     <none>         <none>       (no description available)
ii  mopidy-local   3.2.1-1        all          Mopidy extension for playing music from your local music archive
ii  mopidy-mpd     3.1.0-1        all          Mopidy extension for controlling Mopidy from MPD clients
ii  mopidy-spotify 4.1.1-0mopidy1 all          Mopidy extension for playing music from Spotify
ii  mopidy-tunein  1.1.0-1        all          Mopidy extension for playing music from TuneIn

mopidy log

ec 09 09:15:44 nas mopidy[3275199]: DEBUG    [MainThread] mopidy.ext Loading entry point: spotify = mopidy_spotify:Extension
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [MainThread] mopidy.ext Loaded extension: Mopidy-Spotify 4.1.1
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [MainThread] mopidy.ext Discovered extensions: jellyfin, spotify, local, file, http, m3u, softwaremixer, stream, mpd, tunein
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [MainThread] mopidy.ext Validating extension: spotify
dec 09 09:15:44 nas mopidy[3275199]: INFO     [MainThread] mopidy.__main__ Enabled extensions: tunein, softwaremixer, mpd, stream, jellyfin, m3u, spotify, file, http, local
dec 09 09:15:44 nas mopidy[3275199]: INFO     [MainThread] mopidy.commands Starting Mopidy backends: JellyfinBackend, SpotifyBackend, LocalBackend, FileBackend, M3UBackend, StreamBackend, TuneInBackend
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Fetching OAuth token from https://auth.mopidy.com/spotify/token
dec 09 09:15:44 nas mopidy[3275199]: ERROR    [SpotifyEventLoop] spotify.session Spotify login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6>
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [SpotifyEventLoop] mopidy_spotify.backend Logged out of Spotify
dec 09 09:15:44 nas mopidy[3275199]: DEBUG    [SpotifyEventLoop] mopidy_spotify.backend Logged out of Spotify
dec 09 09:15:45 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Token expires in 3600 seconds.
dec 09 09:15:45 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Token scopes: playlist-read-private playlist-read-collaborative streaming user-library-read user-follow-read user-lib
rary-modify playlist-modify-private playlist-modify-public user-read-recently-played user-read-private user-top-read
dec 09 09:15:45 nas mopidy[3275199]: INFO     [SpotifyBackend-3] mopidy_spotify.web Logged into Spotify Web API as <username>
dec 09 09:15:45 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:2KNP81ECEsh8psq27qhFiV'"
dec 09 09:15:46 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.translator 'spotify:track:78y95AIIs8ToLIZ84dUF3s' is not playable
dec 09 09:15:47 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:77EWkKzCbzAFzUvh2OeEW0'"
dec 09 09:15:47 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:4FUbyL9nT8VknrPig2uJqe'"
dec 09 09:15:47 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:4QQP6fhKqYamKk7VeVAe61'"
dec 09 09:15:47 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:4qcbp982BHISMTCQ8eiygl'"
....
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.translator 'spotify:track:2lk7MdiKyifmCrb6jw4kju' is not playable
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:3NXGDfro8Jf3GgoOlrvZlI'"
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.translator 'spotify:track:4cspA2TX7Ou29uV68ssBQR' is not playable
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.translator 'spotify:track:4cspA2TX7Ou29uV68ssBQR' is not playable
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:0l92UabLyRHluwgys6k2fC'"
dec 09 09:16:02 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:6Gk0Py936qj0UEDcRo4232'"
dec 09 09:16:03 nas mopidy[3275199]: INFO     [SpotifyBackend-3] mopidy_spotify.playlists Refreshed 31 Spotify playlists
dec 09 09:16:03 nas mopidy[3275199]: DEBUG    [SpotifyBackend-3] mopidy_spotify.utils playlists.refresh() took 17545ms

rchovan avatar Dec 09 '21 08:12 rchovan

Playlists are retrieved via the Web API. They can only be retrieved this way.

Email won't work. A normal Spotify username + password are required for this extension.

kingosticks avatar Dec 09 '21 08:12 kingosticks

I can successfully login with my username + password in browser, and mopidy extension is authorized

image

but in logs is still error

dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Fetching OAuth token from https://auth.mopidy.com/spotify/token
dec 09 09:40:03 nas mopidy[3289401]: ERROR    [SpotifyEventLoop] spotify.session Spotify login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6>
dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyEventLoop] mopidy_spotify.backend Logged out of Spotify
dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyEventLoop] mopidy_spotify.backend Logged out of Spotify
dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Token expires in 3600 seconds.
dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyBackend-3] mopidy_spotify.web Token scopes: playlist-read-private playlist-read-collaborative streaming user-library-read user-follow-read user-library-modify playlist-modify-private playlist-modify-public user-read-recently-played user-read-private user-top-read
dec 09 09:40:03 nas mopidy[3289401]: INFO     [SpotifyBackend-3] mopidy_spotify.web Logged into Spotify Web API as ....
dec 09 09:40:03 nas mopidy[3289401]: DEBUG    [SpotifyBackend-3] mopidy_spotify.playlists Fetching Spotify playlist "'spotify:playlist:2KNP81ECEsh8psq27qhFiV'"
dec 09 09:40:05 nas mopidy[3289401]: DEBUG    [SpotifyBackend-3] mopidy_spotify.translator 'spotify:track:78y95AIIs8ToLIZ84dUF3s' is not playable

rchovan avatar Dec 09 '21 08:12 rchovan

When you login to Spotify in your browser and the login form asks for

Email address or username

Do you enter a username or an email address?

kingosticks avatar Dec 09 '21 09:12 kingosticks

I enter username, as displayed on account page.

rchovan avatar Dec 09 '21 10:12 rchovan

Hmm. Is it possible your password contains any special characters that we might be misinterpreting in the config file parsing? For example ';' characters? '#' characters?

kingosticks avatar Dec 09 '21 16:12 kingosticks

And you do have a Spotify Premium account, right?

kingosticks avatar Dec 09 '21 16:12 kingosticks

Yes, I have fulfilled all prerequisites

  • [x] premium account
  • [x] non FB account
  • [x] packages dependencies
  • [x] verified account + password in browser private window logon to spotify
  • [x] authorized access to mopidy-spotify over https://mopidy.com/ext/spotify/#authentication
coudy@nas:~$ LC_ALL=C dpkg -l "*mopidy*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version        Architecture Description
+++-================-==============-============-================================================================
ii  mopidy           3.2.0-1        all          extensible music server
ii  mopidy-alsamixer 2.0.1-1        all          Mopidy extension for volume control via ALSA
un  mopidy-doc       <none>         <none>       (no description available)
ii  mopidy-local     3.2.1-1        all          Mopidy extension for playing music from your local music archive
ii  mopidy-mpd       3.1.0-1        all          Mopidy extension for controlling Mopidy from MPD clients
ii  mopidy-spotify   4.1.1-0mopidy1 all          Mopidy extension for playing music from Spotify
ii  mopidy-tunein    1.1.0-1        all          Mopidy extension for playing music from TuneIn

coudy@nas:~$ LC_ALL=C dpkg -l "*spotify*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name               Version        Architecture Description
+++-==================-==============-============-=====================================================
ii  libspotify12       12.1.51-1      amd64        Library for using the Spotify music streaming service
ii  mopidy-spotify     4.1.1-0mopidy1 all          Mopidy extension for playing music from Spotify
un  python-spotify-doc <none>         <none>       (no description available)
ii  python3-spotify    2.1.3-0mopidy1 amd64        Python bindings for libspotify (Python 3)

mopidy.conf

[spotify]
enabled = true
username = myaccountlowercase ; Must be set.
password = mypassword  ; Must be set.
client_id = 2f4fe813-redacted
client_secret = JMh2-redacted
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 = 20
search_track_count = 50
toplist_countries = 

rchovan avatar Dec 09 '21 18:12 rchovan

Hmm. Is it possible your password contains any special characters that we might be misinterpreting in the config file parsing? For example ';' characters? '#' characters?

My password contains uppercase, lowercase characters, number and one dot

rchovan avatar Dec 09 '21 18:12 rchovan

and now.. it is solved, you have right point,

when I've changed

username = myaccountlowercase ; Must be set.
password = mypassword  ; Must be set.

to

username = myaccountlowercase
password = mypassword 

mopidy is successfully logged

comment ; Must be set. are generated with mopidyctl config and I used it as a template for my config.

Thank for your time and help.

rchovan avatar Dec 09 '21 19:12 rchovan

Sounds like you have a very full mopidy.conf. We don't recommend people do this (and that advice is in the docs) but there you go. I guess we could have resolved this sooner if I'd requested the output of sudo mopidyctl config, my bad,

Related to https://github.com/mopidy/mopidy/issues/1868

kingosticks avatar Dec 10 '21 09:12 kingosticks