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

Login not working #87

Closed
bowilliams opened this issue May 21, 2014 · 96 comments
Closed

Login not working #87

bowilliams opened this issue May 21, 2014 · 96 comments

Comments

@bowilliams
Copy link

Starting this morning, I'm not able to login. I've tried several accounts (all premium).

console.log('about to login');
Spotify.login(login.username, login.password, function (err, spotify) {
  console.log('logged in');

Never gets to logged in- it either hangs at about to login, or I get this error:

TypeError: Cannot read property 'version' of undefined
    at Spotify._resolveAP (/Users/bwilliams/repos/prosecco/local_spotify_player/node_modules/spotify-web/lib/spotify.js:306:50)
    at Spotify._onauth (/Users/bwilliams/repos/prosecco/local_spotify_player/node_modules/spotify-web/lib/spotify.js:294:10)
    at Request.callback (/Users/bwilliams/repos/prosecco/local_spotify_player/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:584:30)
    at Request.<anonymous> (/Users/bwilliams/repos/prosecco/local_spotify_player/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:133:10)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/Users/bwilliams/repos/prosecco/local_spotify_player/node_modules/spotify-web/node_modules/superagent/lib/node/index.js:714:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)
@fuzeman
Copy link

fuzeman commented May 22, 2014

I've looked into this issue a bit, the 'ping_flash2' command has been changed (again), but it isn't a simple key change this time.

We will probably need to determine the new algorithm used for generating 'pong_flash2' responses. I've traced this back to a "ping_pong" method in "player.swf", but this would need to be deobfuscated.

Not sure how this was found originally, maybe someone else has some ideas?

@bowilliams
Copy link
Author

Bummer, that's what I was afraid of! Thanks for looking.

@adammw
Copy link
Collaborator

adammw commented May 22, 2014

I can't get it the way I'd like, seems like it's not a simple XOR operation anymore but a bit more complex logic, but I can brute force it (ugly I know, but it works): https://gist.github.com/adammw/7f192694c3ed0b13f1f9

@reimertz
Copy link

@adammw Good work, that really works!

@AndreSteenbergen
Copy link

Do you have means to run player.swf locally, or did you make 256 manual calls to sp_run?

I tried to find any way to calculate the correct number, but so far no luck ...

@pablorusso
Copy link

I have been working a bit with this too. I haven't had any luck in decompiling the flash file, but I managed to host the flash file in a local server and obtaining the real pong value using a headless selenium.

I am using flask to load a webserver and then I use selenium to fetch the page and look for the value, whichs opens a firefox to render the page. I managed to do it headless in linux with xvfb.

Final user don't see what is happeing behind the hood, but is slow, requires firefox and flash, so is not something you would like in a library.

Anyway I wanted to share this info, in case you can think of a better alternative based on this. Firefox is the real PITA, I couldn't find a better way to render a HTML+JS+Flash.

@TooTallNate
Copy link
Owner

In a perfect world we would fire up Shumway within Node.js and load up the player.swf file and invoke the ping_pong function directly.

I know that @adammw looked into this idea though and there were complications related to the fact that the swf file uses Adobe Alchemy to compile C code to Flash, which Shumway didn't support (at the time... not sure if that's changed or not).

@pablorusso
Copy link

Just in case it matters, the flash funtion I call is "sp_run"

@Miladiir
Copy link

@adammw 's solution doesnt work for me unfortunetly, atleast thats how I interprete it...

C:\Users\miladiir\Desktop\spotify-mp3-downloader-master>node app.js
Server running, to use, open http://localhost:1717 in your browser.
ReferenceError: message is not defined
    at Spotify.<anonymous> (C:\Users\miladiir\Desktop\spotify-mp3-downloader-mas
ter\app.js:104:15)
    at C:\Users\miladiir\Desktop\spotify-mp3-downloader-master\spotify-web\lib\s
potify.js:65:8
    at Spotify.onLogin (C:\Users\miladiir\Desktop\spotify-mp3-downloader-master\
spotify-web\lib\spotify.js:197:5)
    at Spotify.EventEmitter.emit (events.js:92:17)
    at Spotify._onuserinfo (C:\Users\miladiir\Desktop\spotify-mp3-downloader-mas
ter\spotify-web\lib\spotify.js:1239:8)
    at fn (C:\Users\miladiir\Desktop\spotify-mp3-downloader-master\spotify-web\l
ib\spotify.js:396:10)
    at Spotify._onmessage (C:\Users\miladiir\Desktop\spotify-mp3-downloader-mast
er\spotify-web\lib\spotify.js:412:5)
    at WebSocket.EventEmitter.emit (events.js:98:17)
    at Receiver.self._receiver.ontext (C:\Users\miladiir\node_modules\ws\lib\Web
Socket.js:697:10)
    at Receiver.opcodes.1.finish (C:\Users\miladiir\node_modules\ws\lib\Receiver
.js:397:14)
^C

Without the modification I don't get any message at all.

@adammw
Copy link
Collaborator

adammw commented May 25, 2014

@Miladiir that's an exception in your code, not ours.

@dralletje
Copy link

Replaced Spotify.prototype.sendPong in lib/spotify.js with @adammw s code, but still not getting logged in.
This is the debug log: https://gist.github.com/dralletje/fbeffd8a0afb1ed14468

Am I doing something wrong?

@brandtabbott
Copy link

@adammw thanks for the fix!

@TooTallNate
Copy link
Owner

You know, I'm not sure what changed on their end, but the current code in the repo is working for me again (without @adammw's patch).

Can anybody else confirm?

@Miladiir
Copy link

Yep.

I used npm install spotify-web so not entirely sure if it is the code from master or from some tag, but it definetly works without the fix again. Seems a little bit slower than before though.

@patrickrb
Copy link

I seem to be running into this issue as of this morning.

@TooTallNate
Copy link
Owner

Yup :(

On Mon, Jul 28, 2014 at 8:15 AM, Patrick Burns notifications@github.com
wrote:

I seem to be running into this issue as of this morning.


Reply to this email directly or view it on GitHub
#87 (comment)
.

@patrickrb
Copy link

I tried putting @adammw brute force into the spotify.js, no luck. Can we open the issue back up?

@TooTallNate TooTallNate reopened this Jul 28, 2014
@juanmito
Copy link

Any idea?

I've been working on this issue. I've only discover that 5º position on pong is 4º ping position XOR 37, and last ping position (19) changes first pong position sometimes. I'm trying to find any pattern. I think it should be great if anyone who discover something could share it here. I'll post my discovers if anyone want :)

@AndreSteenbergen
Copy link

It looks like the algorithm got a lot smarter, it is not relating one index to one other. It seems it is changing the internals quite a lot, the final byte looks like it triggers some sort of if/ else effect.

The final byte seems to trigger position 1, 2, 6, 7 and 9, but it also varies at what number it uses the if/ else branche ....

document.querySelector('[id_=player]').sp_run("12 23 125 43 56 72 56 76 45 34 12 64 127 143 1 2 3 4 5 10")
"116 189 235 111 47 29 228 95 97 132"
document.querySelector('[id
=_player]').sp_run("12 23 125 43 56 72 56 76 45 34 12 64 127 143 1 2 3 4 5 11")
"116 70 228 111 47 29 235 164 97 175"

document.querySelector('[id_=player]').sp_run("0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0")
"95 159 26 39 208 37 53 150 97 187"
document.querySelector('[id
=_player]').sp_run("0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1")
"95 100 53 39 208 37 26 109 97 144"

10 and 11 here both give:
"95 159 26 39 208 37 53 150 97 187"

@adammw
Copy link
Collaborator

adammw commented Jul 29, 2014

Yep, looks really complex. I'm guessing the idea is that to brute force the algorithm will take a non-trivial amount of time.
So I've found pretty much the same as you @juanmito and @AndreSteenbergen:
https://gist.github.com/adammw/150435df1e8987606a7e

@adammw
Copy link
Collaborator

adammw commented Jul 29, 2014

Interesting. I decided to investigate byte 3 further and found that it depends on input byte 7 when input byte 6 is zero, and then only on input byte 6 for all other values. But it doesn't seem to be an XOR of byte 6 so it's only so helpful.
Update: it uses the same 256-item sequence though: https://gist.github.com/adammw/31d7fcf571947f62cea0 (gives byte 3 output)
Update: I was wrong. This is crazy.

@juanmito
Copy link

Its really complex. Almost all inputs affect all outputs

0 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
1 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
3 --> 0 1 2 3 4 5 6 7
4 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
5 --> 0 1 2 3 4
6 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
7 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
8 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
9 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

@ghost
Copy link

ghost commented Jul 29, 2014

Maybe we can try another solution. Instead of emulating player.swf functionality, we could call and use it to get the pong chain and follow the workflow. Any idea of executing the swf file directly from node and calling sp_run function?

@madjam002
Copy link

I've been trying this evening to call sp_run using Shumway, but I don't fully understand it.
Using Shumway, I console.log'd all calls to ExternalInterface.addCallback and the following callbacks got registered:

sp_hasSound
sp_load
sp_play
sp_playpause
sp_stop
sp_pause
sp_resume
sp_time
sp_seek
sp_playerState
sp_setVolume
sp_getVolume
sp_getDuration
sp_initializePlayerById
sp_addPlayer
sp_removePlayerAtIndex 

No sp_run there :( It's probably because the part of player.swf that does the pong stuff is obfuscated whilst the rest isn't, and I don't think Shumway understands it.

Even if sp_run was there, I haven't figured out a way to invoke any of the external callbacks :(

@nevilgeorge-zz
Copy link

I followed this thread, but when I use @1994rstefan 's solution, my music plays sometimes, but sometimes gives me a "Failed to send to backend (Invalid user)" error. Does anyone know how fix this?

I'd really appreciate it!

@denysvitali
Copy link
Contributor

Have you guys though about integrating the player within node-webkit (https://github.com/rogerwang/node-webkit) instead of including it in a separate worker-server?
Let me know your thougs, I'll try to implement it by myself today and see if it works

@Watiswat
Copy link

@1994rstefan Did your server crash again? it isn't working anymore:( Please advice.

@1994rstefan
Copy link

denysvitali added a commit to denysvitali/node-spotify-web that referenced this issue Dec 10, 2014
@raph80
Copy link

raph80 commented Dec 11, 2014

My brain is fried and I'm not smart enough to figure out what to do

What do I have to do to get Spotify Mp3 Downloader working again? Please help the uninitiated.

@juanmito
Copy link

Hi
@raph80 just take a look to this thread: #96

It will solve your problem

TooTallNate pushed a commit that referenced this issue Dec 11, 2014
Closes #98.

Squashed commit of the following:

commit 547cb2b
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 18:15:25 2014 +0100

    Removed request dependency

commit 435b266
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 18:15:02 2014 +0100

    Replaced request with superagent

commit e661d43
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 12:28:44 2014 +0100

    Update package.json

commit e971f19
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 12:01:08 2014 +0100

    Added request module to deal with sendPong

commit 200f5c0
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 12:00:30 2014 +0100

    Updated Spotify sendPong

commit b08ed0d
Author: Denys Vitali <denys@denv.it>
Date:   Thu Dec 11 00:42:39 2014 +0100

    Updated Spotify sendPong

    Thanks to @1994rstefan

    #87 (comment)
@Watiswat
Copy link

Watiswat commented Jan 9, 2015

Login failed again... invalid username/password it says .. anyone?

@giacecco
Copy link

@Watiswat see #102 .

@Watiswat
Copy link

@giacecco thanks, problem solved!

@jeffdran
Copy link

jeffdran commented May 6, 2015

So, it seems that login isn't working for me anymore. I've been running my own pingpong server, and it says it's returning the pong ok, but still fails to login. Only have one pong worker if that helps.

I tried ping-pong.spotify.nodestuff.net, but seems to be down at the moment. Anyone else having issues?

@sciencepro
Copy link

Seeing similar issues with login via facebook or credentials.

@jeffdran
Copy link

jeffdran commented May 6, 2015

It's just weird because it's not throwing any errors at all. Making it a little difficult to debug.

@sciencepro
Copy link

Yeah it's just spitting out a 403, I have not had the chance yet to dive in and see where it is failing.

@sciencepro
Copy link

@TooTallNate should there be a new issue for this, or re-open this one? Will try to examine this further after my finals

@sciencepro
Copy link

Seems to be working again

@jeffdran
Copy link

jeffdran commented May 6, 2015

Not working for me :/

Edit: Got it working. Just didn't have the header set to application/json for server.js.

@1994rstefan
Copy link

Hello,
try to update the Flash-File on your local server.


Von: jeffdranmailto:notifications@github.com
Gesendet: ‎06.‎05.‎2015 19:13
An: TooTallNate/node-spotify-webmailto:node-spotify-web@noreply.github.com
Cc: Stefanmailto:stefan_1994@live.de
Betreff: Re: [node-spotify-web] Login not working (#87)

Got it working with the server, but it's not working from local server.


Reply to this email directly or view it on GitHub:
#87 (comment)

@jeffdran
Copy link

Instead of making a new thread... anyone here experiencing "Track is not playable in country" issues? I can login fine, but cannot access track info. My assumption is they changed country codes to numbers.

@sciencepro
Copy link

@jeffdran Prior to updating to the latest commit, I was getting errors like

{ [TrackError: Account subscription status not Spotify Premium]
  domain: 12,
  code: 0,
  description: '',
  data: null,
  name: 'TrackError',
  message: 'Account subscription status not Spotify Premium' }

After updating, I'm getting Track is not playable in country

@jeffdran
Copy link

@sciencepro I was getting the same issue until I updated. It's definitely recent, I had no problems about 2 days ago. I'll try looking into it either tonight or tomorrow morning.

@Watiswat
Copy link

@jeffdran I'm getting the same track error since a couple days, any clue what the problem might be?

@denysvitali
Copy link
Contributor

Duplicate of #111

@ghost
Copy link

ghost commented Sep 8, 2016

Hi Guys, I got this spotify music download about 6 months ago, it was working fine until now, any suggestions ??

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

No branches or pull requests