question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MercuryException: status: 403

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jcadduonocommented, Jan 18, 2022

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)!

0reactions
rpardinicommented, Jan 31, 2022

@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.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

403 Forbidden error received in response to a Rest API request
The error indicates that you don't have authorization to perform the request. Follow the steps below to grant permission. 1. In OFS, navigate...
Read more >
HTTP 403 Forbidden | What is 403 Forbidden Error and How ...
HTTP 403 forbidden error code means that the server understood the request but will not process it. Learn more about 403 forbidden error ......
Read more >
403 Forbidden error: What it is and how to fix it - Allconnect.com
A 403 error is an HTTP status code that means “access denied.” If you ever had a treehouse as a kid, you may...
Read more >
403 Forbidden - HTTP - MDN Web Docs - Mozilla
The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it.
Read more >
HTTP Error 403 Forbidden: What It Means and How to Fix It
The 403 (Forbidden) status code indicates that the server understood the request but refuses to authorize it...If authentication credentials ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found