aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.38k stars 147 forks source link

Authentication failed: Bad credentials #520

Closed ManiArasteh closed 17 hours ago

ManiArasteh commented 1 month ago

Hi. I installed spotify-player but I get Bad credentials error. I entered the correct username and password and I have Premium account, too, but it failed. Can you help me fix this?

GigaScratch commented 1 month ago

Installed today (via aur/spotify-player-full-pipe 0.19.1-1) and am also getting this. Logs seem okay but also pretty empty aside from having a full config list.

2024-07-29T11:11:35.961162Z  INFO spotify_player: Configurations: Configs { app_config: AppConfig { theme: "dracula", client_id: "65b708073fc0480ea92a077233ca87bd", client_port: 8080, player_event_hook_command: None, playback_format: "{status} {track} • {artists}\n{album}\n{metadata}", notify_format: NotifyFormat { summary: "{track} • {artists}", body: "{album}" }, notify_timeout_in_secs: 0, tracks_playback_limit: 50, proxy: None, ap_port: None, app_refresh_duration_in_ms: 32, playback_refresh_duration_in_ms: 0, page_size_in_rows: 20, play_icon: "▶", pause_icon: "▌▌", liked_icon: "♥", border_type: Plain, progress_bar_type: Rectangle, playback_window_position: Top, cover_img_length: 9, cover_img_width: 5, cover_img_scale: 1.0, playback_window_width: 6, enable_media_control: true, enable_streaming: Always, enable_notify: true, enable_cover_image_cache: true, default_device: "spotify-player", device: DeviceConfig { name: "spotify-player", device_type: "speaker", volume: 70, bitrate: 320, audio_cache: false, normalization: false, autoplay: false }, notify_streaming_only: false, seek_duration_secs: 5 }, keymap_config: KeymapConfig { keymaps: [Keymap { key_sequence: KeySequence { keys: [None(Char('n'))] }, command: NextTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('p'))] }, command: PreviousTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('.'))] }, command: PlayRandom }, Keymap { key_sequence: KeySequence { keys: [None(Char(' '))] }, command: ResumePause }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('r'))] }, command: Repeat }, Keymap { key_sequence: KeySequence { keys: [Alt(Char('r'))] }, command: ToggleFakeTrackRepeatMode }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('s'))] }, command: Shuffle }, Keymap { key_sequence: KeySequence { keys: [None(Char('+'))] }, command: VolumeUp }, Keymap { key_sequence: KeySequence { keys: [None(Char('-'))] }, command: VolumeDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('_'))] }, command: Mute }, Keymap { key_sequence: KeySequence { keys: [None(Char('>'))] }, command: SeekForward }, Keymap { key_sequence: KeySequence { keys: [None(Char('<'))] }, command: SeekBackward }, Keymap { key_sequence: KeySequence { keys: [None(Enter)] }, command: ChooseSelected }, Keymap { key_sequence: KeySequence { keys: [None(Char('r'))] }, command: RefreshPlayback }, Keymap { key_sequence: KeySequence { keys: [None(Char('/'))] }, command: Search }, Keymap { key_sequence: KeySequence { keys: [None(Char('z'))] }, command: Queue }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('z'))] }, command: AddSelectedItemToQueue }, Keymap { key_sequence: KeySequence { keys: [None(Char('Z'))] }, command: AddSelectedItemToQueue }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char(' '))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('a'))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('a'))] }, command: ShowActionsOnCurrentTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('R'))] }, command: RestartIntegratedClient }, Keymap { key_sequence: KeySequence { keys: [None(Tab)] }, command: FocusNextWindow }, Keymap { key_sequence: KeySequence { keys: [None(BackTab)] }, command: FocusPreviousWindow }, Keymap { key_sequence: KeySequence { keys: [None(Char('T'))] }, command: SwitchTheme }, Keymap { key_sequence: KeySequence { keys: [None(Char('D'))] }, command: SwitchDevice }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('p'))] }, command: BrowseUserPlaylists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('a'))] }, command: BrowseUserFollowedArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('A'))] }, command: BrowseUserSavedAlbums }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char(' '))] }, command: CurrentlyPlayingContextPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('t'))] }, command: TopTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('r'))] }, command: RecentlyPlayedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('y'))] }, command: LikedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('L'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('l'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('l'))] }, command: LibraryPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('s'))] }, command: SearchPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('b'))] }, command: BrowsePage }, Keymap { key_sequence: KeySequence { keys: [None(Backspace)] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('q'))] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('O'))] }, command: OpenSpotifyLinkFromClipboard }, Keymap { key_sequence: KeySequence { keys: [None(Char('?'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('h'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [None(Char('q'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('c'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [None(Esc)] }, command: ClosePopup }, Keymap { key_sequence: KeySequence { keys: [None(Char('j'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('n'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Down)] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('k'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('p'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(Up)] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageUp)] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('b'))] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageDown)] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('f'))] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('g'))] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Home)] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Char('G'))] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(End)] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('t'))] }, command: SortTrackByTitle }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('a'))] }, command: SortTrackByArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('A'))] }, command: SortTrackByAlbum }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('d'))] }, command: SortTrackByDuration }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('D'))] }, command: SortTrackByAddedDate }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('r'))] }, command: ReverseTrackOrder }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('k'))] }, command: MovePlaylistItemUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('j'))] }, command: MovePlaylistItemDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('N'))] }, command: CreatePlaylist }], actions: [] }, theme_config: ThemeConfig { themes: [Theme { name: "default", palette: Palette { background: None, foreground: None, black: Color { color: Black }, blue: Color { color: Blue }, cyan: Color { color: Cyan }, green: Color { color: Green }, magenta: Color { color: Magenta }, red: Color { color: Red }, white: Color { color: Gray }, yellow: Color { color: Yellow }, bright_black: Color { color: DarkGray }, bright_white: Color { color: White }, bright_red: Color { color: LightRed }, bright_magenta: Color { color: LightMagenta }, bright_green: Color { color: LightGreen }, bright_cyan: Color { color: LightCyan }, bright_blue: Color { color: LightBlue }, bright_yellow: Color { color: LightYellow } }, component_style: ComponentStyle { block_title: None, border: None, playback_status: None, playback_track: None, playback_artists: None, playback_album: None, playback_metadata: None, playback_progress_bar: None, current_playing: None, page_desc: None, playlist_desc: None, table_header: None, selection: None, secondary_row: None } }] }, cache_folder: "/home/olivia/.cache/spotify-player" }
2024-07-29T11:11:35.962364Z  INFO spotify_player::auth: Creating a new session with new authentication credentials
2024-07-29T11:12:19.276628Z  WARN spotify_player::auth: Failed to authenticate: Login failed with reason: Bad credentials
2024-07-29T11:12:38.747635Z  WARN spotify_player::auth: Failed to authenticate: Login failed with reason: Bad credentials
2024-07-29T11:13:34.041577Z  WARN spotify_player::auth: Failed to authenticate: Login failed with reason: Bad credentials
elipp commented 1 month ago

New user here - I also can't seem to be able to login.

Version: 0.19.1, installed via cargo install spotify_player.

Does this require a "Premium Individual" account? I have "Premium Family"

aome510 commented 1 month ago

can reproduce by deleting my cached credentials. Not sure what has been changed recently. I will take a look later today.

aome510 commented 1 month ago

It seems Spotify changed the authentication workflow that breaks the library spotify_player is using: https://github.com/librespot-org/librespot/issues/1308. Let's monitor that thread to see how they gonna fix it.

C4theBomb commented 1 month ago

Hi, I'm here from NixOS where its also broken and I'm also looking for a fix. Read the above thread, its made some progress and they have a new method.

Just a summary of the associated conversation from the above thread. Cause: Spotify completely removed username&password authentication from the API through Hermes/Mercury.

Associated fix: They have a proposed solution, and someone there has a working fix. They new fix switches to OAuth2 as their method of authentication.

Here is the new workflow that they are using: https://github.com/librespot-org/librespot/issues/1308#issuecomment-2258478905

Associated changes to the librespot client: https://github.com/devgianlu/go-librespot/commit/1e82a276812d5ef5ca0a52fe7d993ea549667a17

Onotate commented 1 month ago

Somehow it is working again..

C4theBomb commented 1 month ago

Same here. I'd keep watching for another 24 hours but if not this should be resolved @aome510. Spotify rolled back the code, though librespot is still planning on trying to switch to OAuth2 based auth.

GigaScratch commented 1 month ago

Working now for me as well.

Super nice they're prioritizing OAuth though, I am not keen on entering my login details directly, even if open source.

elipp commented 1 month ago

Works for me too!

ManiArasteh commented 1 month ago

I still have the same problem. Can you login?

aome510 commented 1 month ago

works for me today too

ManiArasteh commented 1 month ago

Not for me. I still having the problem. Did you do something?

aome510 commented 1 month ago

no I didn't. Maybe Spotify rolled back the changes region by region, so it might take a while for your to be updated

ManiArasteh commented 1 month ago

Ok. Waiting to apply the changes

ManiArasteh commented 1 month ago

It's not working. But anyway, I close this issue.

ManiArasteh commented 1 month ago

Still not working. I reopen this issue until the problem will be fixed.

ManiArasteh commented 1 month ago

Read this :point_down:

Developer of librespot got an email that the login method the library uses will not supported anymore in a few days. Shared in issue that @aome510 referenced.

ecabigting commented 1 month ago

can reproduce by deleting my cached credentials. Not sure what has been changed recently. I will take a look later today.

having the same issue, it was working this morning, but when I accidentally cleared my cached credentials, i cannot seem to login. Do we have any work arounds?

luinbytes commented 1 month ago

Can confirm still an issue also, worked fine yesterday and now auth is failing.

ManiArasteh commented 1 month ago

Spotify removed authentication workflow completely. Now, what should we do? :sob:

casualNavigator commented 1 month ago

Can confirm I have the same problem just today,

I'm on a Spotify Premium account, the credentials are correct --tested logging in using the official client and the web player.

I was using spotify-player cli as the controller and spotifyd as the device to stream to, but today both stopped working (I'm still on a Spotify Premium plan).

First I tried to resolve the issue with spotifyd:

I use the keyring option in the spotifyd config file spotifyd.conf, -so spotifyd gets the password from the keyring- which had no issue until today. So then tried setting the Spotify credentials manually for spotifyd, which also didn't work.

Ran spotfyd withspotifyd --no-daemon --debug-credentials,

I can see the output:

...
...
failed to connect to spotify: Login failed with reason: Bad credentials

Even though the credentials is indeed correct.

What worked for spotifyd was:

I had to remove all password entries from the spotifyd config file, which makes spotifyd use zeroconf authentification. This enabled the spotifyd device to be recognized from the official Spotify client and able to stream to it. (spotfyd is needed to run alongside the official Spotify client on the same machine -just for once for zeroconf authentification).

Now that spotifyd is being recognized by the official Spotify client, I deleted the spotify-player cli cache files in ~/.config/cache/spotify-player for a fresh slate, and ran spotify-player again, but got:

Failed to authenticate, 2 tries left

even through the credentials is correct.

Summary:

After setting spotifyd to use zerconf authentification, the spotifyd device is recognized on the official Spotify client and web player and is able be streamed to. But, spotify-player cli can't be run, as it is not able to authenticate even though the credentials are correct.

ManiArasteh commented 1 month ago

Maybe we can use another library or create an app called "applemusic-player" for using Apple Music in Terminal :joy:

repparw commented 1 month ago

I have the same problem after formatting my pc. Is this affecting all new installs right now? Did spotify provide a new auth method at least or something? Maybe something with client/secret keys?

ManiArasteh commented 1 month ago

IIs this affecting all new installs right now?

Yes. This affecting all new installs.

norbeyandresg commented 1 month ago

Same error here. Is there any workaround to authenticate while they fix the issue?

ManiArasteh commented 1 month ago

Someone opened a PR for librespot. I wanna test it now.

ManiArasteh commented 1 month ago

I can't work with librespot

norbeyandresg commented 1 month ago

@ManiArasteh no luck trying to authenticate with the changes of the pr you mention for librespot?

ManiArasteh commented 1 month ago

no luck trying to authenticate with the changes of the pr you mention for librespot?

No! I can't work with librespot. I'm new to Rust, and even I use ChatGPT for creating Rust application. I work with Python (Sometimes with C#, HTML, CSS and JavaScript). You can see in my repositories.

Go to BeagleEditor repository. I created with Python.

ManiArasteh commented 1 month ago

Someone having same problem. #547

repparw commented 4 weeks ago

Can someone who still has their cached credentials share what the file location and syntax is? So I can look for a workaround authenticating with client/secret or something

casualNavigator commented 4 weeks ago

@ManiArasteh @repparw @norbeyandresg @ecabigting @luinbytes

Was able to regenerate my credentials.json with this: https://github.com/dspearson/librespot-auth

ManiArasteh commented 4 weeks ago

I deleted MSVC. I must reinstall it

ManiArasteh commented 4 weeks ago

Wow! It worked with repository that @casualNavigator mentioned! But I won't close this issue

aome510 commented 4 weeks ago

Hey guys, I'm keeping my eyes on the librespot issue to see when they implement a patch and will update spotify_player accordingly. This is very unfortunate 😞 but it's great to hear that there is a workaround (https://github.com/dspearson/librespot-auth)

ManiArasteh commented 4 weeks ago

Yeah, you can use... Aha you wrote that repository link. OK, I'm really sad, too. But I logged in to Spotify player with app that dspearson wrote

On Sun, Aug 18, 2024 at 01:20 Thang Pham @.***> wrote:

Hey guys, I'm keeping my eyes on the librespot issue to see when they implement a patch and will update spotify_player accordingly. This is very unfortunate 😞 but it's great to hear that there is a workaround ( https://github.com/dspearson/librespot-auth)

— Reply to this email directly, view it on GitHub https://github.com/aome510/spotify-player/issues/520#issuecomment-2294994910, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIRU5HCRC3IBRW2HRYCIBGTZR7AUFAVCNFSM6AAAAABLTNHWVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJUHE4TIOJRGA . You are receiving this because you were mentioned.Message ID: @.***>

streof commented 4 weeks ago

Unfortunately, the workaround does not work for me on macOS running the latest version of the Spotify app. I don't see any connected device(s). When I open Spotify on my phone, my phone does appear in the list as expected.

repparw commented 4 weeks ago

Unfortunately, the workaround does not work for me on macOS running the latest version of the Spotify app. I don't see any connected device(s). When I open Spotify on my phone, my phone does appear in the list as expected.

You built and ran librespot-auth to get the credentials? If so it could be firewall blocking the discovery port. Don't know what firewall macos has. Also try from spotify web in the same device if phone doesn't show it

streof commented 4 weeks ago

Turning off the firewall did the trick. Thanks a lot!

I do get this error message for some playlists: [

sp

](url)

Any idea why?

juliusdelta commented 3 weeks ago

Took me a minute to find exactly how to implement the work around so here's a set of instructions that worked for me since this is the issue linked in the README:

  1. Install Rust tool chain following the Rust Documentation instructions
  2. Clone https://github.com/dspearson/librespot-auth
  3. cd into librespot-auth
  4. cargo build --release to build the project
  5. Run the binary ./target/release/librespot-auth --name "Example Speaker"
  6. Open the Spotify client and select "Example Speaker" as the output device
  7. librespot-auth will then create a new credentials.json file in the librespot-auth directory and kill it's own process
  8. Copy that credentials.json file to the spotify_player cache directory (overwriting the one that's already there)
    • On MacOS this is ~/.cache/spotify-player
  9. spotify_player should now work.
kbomb69 commented 3 weeks ago

Quick note for anyone not wanting / unable to disable their firewall: Spotify uses mDNS for discovery, so port 5353 UDP. Opening that allowed me to see the virtual device created by librespot-auth.

khaosdoctor commented 3 weeks ago

Took me a minute to find exactly how to implement the work around so here's a set of instructions that worked for me since this is the issue linked in the README:

  1. Install Rust tool chain following the Rust Documentation instructions
  2. Clone dspearson/librespot-auth
  3. cd into librespot-auth
  4. cargo build --release to build the project
  5. Run the binary ./target/release/librespot-auth --name "Example Speaker"
  6. Open the Spotify client and select "Example Speaker" as the output device
  7. librespot-auth will then create a new credentials.json file in the librespot-auth directory and kill it's own process
  8. Copy that credentials.json file to the spotify_player cache directory (overwriting the one that's already there)

    • On MacOS this is ~/.cache/spotify-player
  9. spotify_player should now work.

Please mark this as the resolution (at least for now), it works on Mac flawlessly

ManiArasteh commented 3 weeks ago

Please don't repeat instructions or giving a review. It will make this issue crowded.

ManiArasteh commented 3 weeks ago

Hey @aome510, You can switch to rspotify. Because rspotify supports OAuth2, when I wanted to test spotify-tui, I saw that it uses OAuth2, with rspotify module

aome510 commented 3 weeks ago

Hey @aome510, You can switch to rspotify. Because rspotify supports OAuth2, when I wanted to test spotify-tui, I saw that it uses OAuth2, with rspotify module

I do use rspotify in the app. librespot is used for bunch of different things, one of which is streaming. spotify-tui doesn't support streaming, so they can use rspotify exclusively.

ManiArasteh commented 3 weeks ago

Hmm, OK

brokoli18 commented 3 weeks ago

I did this, obtained the credentials file and put it into ~/.config/spotify-player. However when I start up spotify-client it still says: No cached credentials found, please authenticate the application first. I started the client specifically setting the cache directory with -c but it still didnt work. Am I missing something?

chrisgrieser commented 3 weeks ago

Open the Spotify client and select "Example Speaker" as the output device

Tried to follow the instructions, but hit a roadblock with this step. Neither in the spotify web player, nor in the spotify app, does an Example Speaker ever show up for me. 🤔

guess it's back to spotify_tui for me until this issue resolved.

ManiArasteh commented 3 weeks ago

I did this, obtained the credentials file and put it into ~/.config/spotify-player. However when I start up spotify-client it still says: No cached credentials found, please authenticate the application first. I started the client specifically setting the cache directory with -c but it still didnt work. Am I missing something?

spotify-client or spotify_player?

brokoli18 commented 3 weeks ago

spotify-client or spotify_player?

Pardon, I start up spotify_player

❯ spotify_player
No cached credentials found, please authenticate the application first.
Username: