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

MercuryException: status: 403 #370

Open
amethystant opened this issue Jun 1, 2021 · 9 comments
Open

MercuryException: status: 403 #370

amethystant opened this issue Jun 1, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@amethystant
Copy link

Describe the bug
When trying to connect to my spotify connect device that I set up with librespot autoconf, I get the below exception. The jar doesn't crash but the connection doesn't proceed, basically I click the device in the menu and nothing happens.

To Reproduce
Download the spotify player jar (on a Windows machine). Run it to generate the config file and then stop it. Open the firewall ports as instructed in the README. Edit the generated config file and add the random port you opened, change nothing else and save. Run the jar again and leave running. Open any spotify client app and in the menu of available devices you see 'librespot-java'. Click it - nothing happens and you're not connected. Check the output of the running jar and you'll see the exception below.

Expected behavior
After performing the steps above, I expect me spotify client to be connected to my spotify connect device and when I play music it gets played on the computer running the jar.

Screenshots/Stracktraces/Logs

xyz.gianlu.librespot.mercury.MercuryClient$MercuryException: status: 403
        at xyz.gianlu.librespot.mercury.MercuryClient.sendSync(MercuryClient.java:106) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.core.TokenProvider.getToken(TokenProvider.java:68) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.core.TokenProvider.get(TokenProvider.java:79) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.dealer.DealerClient.connect(DealerClient.java:79) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.core.Session.authenticate(Session.java:353) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.core.Session.access$600(Session.java:75) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.core.Session$Builder.create(Session.java:1021) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer.handleAddUser(ZeroconfServer.java:367) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer.access$200(ZeroconfServer.java:56) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.handleRequest(ZeroconfServer.java:499) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.handle(ZeroconfServer.java:574) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.lambda$run$1(ZeroconfServer.java:482) ~[librespot-player-1.6.0.jar:1.6.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_281]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_281]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]
2021-06-01 10:32:59,765 ERROR ZeroconfServer:501 - Failed handling addUser!
java.net.SocketException: Software caused connection abort: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:1.8.0_281]
        at java.net.SocketOutputStream.socketWrite(Unknown Source) ~[?:1.8.0_281]
        at java.net.SocketOutputStream.write(Unknown Source) ~[?:1.8.0_281]
        at xyz.gianlu.librespot.ZeroconfServer.handleAddUser(ZeroconfServer.java:382) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer.access$200(ZeroconfServer.java:56) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.handleRequest(ZeroconfServer.java:499) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.handle(ZeroconfServer.java:574) ~[librespot-player-1.6.0.jar:1.6.0]
        at xyz.gianlu.librespot.ZeroconfServer$HttpRunner.lambda$run$1(ZeroconfServer.java:482) ~[librespot-player-1.6.0.jar:1.6.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_281]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_281]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]

Version/Commit
Downloaded jar librespot-player-1.6.0.jar

@amethystant amethystant added the bug Something isn't working label Jun 1, 2021
@devgianlu
Copy link
Member

That's interesting and looks very much like the issue we are having with the new Facebook auth flow. What version of the official client are you using?

@amethystant
Copy link
Author

amethystant commented Jun 1, 2021

it's 1.1.60.672.g6ad9c215-a on windows 10. also i've just tried connecting to the device using the android app and all works as expected (that's version 8.6.30.889). also i tried it from my macbook with the same version of the spotify app and that also worked (the Connect device still being the original windows machine). could it be caused by trying to connect from the same system on which the zeroconf server is running?

@devgianlu
Copy link
Member

could it be caused by trying to connect from the same system on which the zeroconf server is running?

That shouldn't be the issue. Can you try logging out and logging in again from the problematic device to see if that fixes it?

@amethystant
Copy link
Author

yeah, unfortunately that didn't help :/

@jcadduono
Copy link

jcadduono commented Jun 19, 2021

I too am having the exact same problem, and had to go to USER_PASS for now which sucks because it only allows the logged in user to stream to the device.
Client version is Windows 10 64-bit 1.1.61.583.gad060c66-a
spocon/librespot 1.6.0 on Debian bullseye amd64
Looks like Spotify did something weird with their Windows desktop client.

@rpardini
Copy link

This same exception started happening with a MacOS Spotify Client (Spotify for macOS (Intel) 1.1.74.631.g0b24d9ad)) this last week. I reset everything and nothing, the dealer keeps on getting 403.
Connecting from Android Spotify works (and then after that, the Mac Spotify can control the session).

@jcadduono
Copy link

At the top right of the desktop app, select your username, and go to Account.
You should be on the “Account overview” page.
You will see your Spotify “Username” there, which is a long string of randomized characters. Save that.
Now go to the “Set device password” page and set a password for your account.

Now log out of the Spotify desktop app, and log in without using Facebook, by using the (long random characters) username & password you just set.

Now the desktop app will send normal Spotify access tokens over Spotify Connect and it should work fine (no more 403 errors)!

@rpardini
Copy link

@jcadduono Confirmed working. Thanks! I'm getting rid of Facebook anyway.
(I previously have confused this with the user/pass settings in librespot-java config or cmdline options, which is inconvenient: it does not allow 2nd/3rd users with their own accounts.)

@powellc
Copy link

powellc commented Jun 16, 2023

I already use a non-Facebook session key from user/pass and am having problems with 403 responses from Mercury regardless of which device I am logged in on (phone, computer, web). Any one have thoughts on what could be causing the permission issues this time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants