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 login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6> #202

Open
tuukkatoivonen opened this issue Nov 7, 2018 · 20 comments
Open

Spotify login error: <ErrorType.BAD_USERNAME_OR_PASSWORD: 6> #202

tuukkatoivonen opened this issue Nov 7, 2018 · 20 comments
Labels
A-libspotify Area: libspotify

Comments

@tuukkatoivonen
Copy link

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?

@Quoteme
Copy link

Quoteme commented Dec 12, 2018

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

@Evidlo
Copy link

Evidlo commented Jun 28, 2019

Bump, this information should be added to the README.

@kingosticks
Copy link
Member

A PR would be welcome.

@renatocribeiro
Copy link

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.

@kingosticks
Copy link
Member

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

@renatocribeiro
Copy link

@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

@kingosticks
Copy link
Member

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?

@adrhc
Copy link

adrhc commented Nov 24, 2021

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

@kingosticks
Copy link
Member

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

@rchovan
Copy link

rchovan commented Dec 9, 2021

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

@kingosticks
Copy link
Member

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.

@rchovan
Copy link

rchovan commented Dec 9, 2021

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

@kingosticks
Copy link
Member

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?

@rchovan
Copy link

rchovan commented Dec 9, 2021

I enter username, as displayed on account page.

@kingosticks
Copy link
Member

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
Copy link
Member

And you do have a Spotify Premium account, right?

@rchovan
Copy link

rchovan commented Dec 9, 2021

Yes, I have fulfilled all prerequisites

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
Copy link

rchovan commented Dec 9, 2021

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
Copy link

rchovan commented Dec 9, 2021

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.

@kingosticks
Copy link
Member

kingosticks commented Dec 10, 2021

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 mopidy/mopidy#1868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-libspotify Area: libspotify
Projects
None yet
Development

No branches or pull requests

7 participants