-
Notifications
You must be signed in to change notification settings - Fork 24
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
Failed to get access token (401 Unauthorized) #108
Comments
Please enable debug logging for Would you have a firewall in place which might be blocking outgoing traffic? |
Thanks for the quick reply and support! I did so and uploaded the server.log.zip. The first error that appears there is:
The account creation via Spotify Desktop App failed two times, after restarting the app (also did an update before that) it work right away. (also did not work immediately before...) The rest is still the same. I think there is no blocking of outgoing traffic that was not there before. The only new thing, is I am using pihole (a DNS server to block ads and stuff), which could interfere. I turned it off, which did not help. Only thing: Maybe it has to be turned off while creating the account or something? However, it does not look like pihole did block any of the requests from my pcpServer... Edit:
Thanks again :) |
In that log file you'll find the full command spotty uses to get a token. Could you please run the same from a shell without the |
If I ssh into the server and run the same spotty-hf command in verbose (also removing some double quotes), simply nothing happens. running Looking at |
Oh, I'm sorry... You'll also have to add the |
Ok, this works, but I am getting |
Hmm... that's odd. Did you add all your Spotify accounts to the client ID configuration? If you have more than one, or create the client with a different account than the one you're using in Spotty you'll have to add them in the Spotify dev portal. |
I tried it with and without the client ID (-i flag), same result. I never needed the client ID, so this should not be the issue, I think. (I'm a bit confused about this. Using the client ID is optional, right? Can I somehow get a "more verbose" reason on why/how getting the Token failed? Should I try to establish a connection to my spotify account on my linux desktop manually to verify my credentials work etc? How would I got about this? I did just create the app in order to get a client ID. Now I also added my account by email, still the same result. |
I'm running out of ideas... Is the server running on a pCP, too? The system's time is correct? Could you try to run LMS & Spotty on a different computer, even a different network? Just to see whether it's a problem with your account, and not your environment? And make sure you've paid your subscription 😄 - Premium is a requirement. |
Ok, so I did some more tests. Server runs pCP, too, system time looks good, premium (family) is there, also it all worked before. I tried my player and server in another network which also has a LMS server and clients. The player worked well with the other server (as expected) but the server failed there in the same way. I will try running LMS on another RPi. I removed the account from the family plan and added it again, still the same. Only new thing I found in the logs when adding the account to spotty was:
|
So what I noticed earlier was that using the Spotify-Desktop App to add the account was not completing:
Thanks for your support ;) |
I can confirm that the authorization via Spotify Desktop app is buggy. I had repeated issues with the very same error |
After many years with Spotty, I now have the same issue, no matter what kind of authorization - via Spotify Desktop app, by user name, or by email address :-( This is on a Mac mini with High Sierra (10.13), LMS 8.4.0 and Spotty 4.9.2. Log from start of LMS: |
Update with more detailed logs - seems like the authentication is ok, but there are communication timeouts? [24-02-18 20:03:10.6613] Plugins::Spotty::Settings::Auth::startHelper (163) Starting Spotty Connect deamon: |
@geni1105 can you check what IO::Socket::SSL you're using (Settings/Information)? If your installation is using the OS' Perl, then that might be outdated, causing web requests to fail. |
Thanks for the quick reaction! Strangely, settings/information is completely empty regarding perl and module versions (see below). "perl -v" gives 5.18, this is the OS's perl under /usr/bin. When I start from the command line with this perl version, the communication errors occur. Edit: there's an openssl under /usr/bin which reports LibreSSL 2.2.7 Logitech Media Server-Status Perl- und Modulversionen Musiksammlungsstatistik |
I think this is more of a LMS on Mac issue than Spotty... Could you please check your server.log file from Settings/Information, after you have accessed that page? There should be at least some failure information for the module reporting. And then please tell me what the following line would return: perl -MIO::Socket::SSL -e 'print $IO::Socket::SSL::VERSION' |
Installed the LMS 8.3.0 now, and this one gives version information: The behavior regarding Spotty is the same, though. perl -MIO::Socket::SSL -e 'print $IO::Socket::SSL::VERSION' returns 2.056 Reinstalled 8.4.0, and now it also gives the version information above. Hmm. But the error is still in the logs - here's a LMS stop and restart sequence: [24-02-19 11:17:26.3664] Plugins::Spotty::Importer::ANON (390) Latest album update: { lastUpdate => "144|2020-01-04T13:22:24Z|", latestUpdate => "||" } |
Update: Everything seems to work again - thanks a lot :-)) |
I can confirm that I had to manually add the Spotify account in LMS for it to work. Got the "failed to get access token" if I authorized via the discovery stuff in the official spotify app. |
Hello! I am completely unable to get a token anymore, also. I have read all the above, tried username/email and password login, tried desktop connect auth, phone connect auth. Below is the relevant bit from my logs (from when I delete and re-add my user via username/password auth). I am using the fallback access point. I am not sure how to check my OpenSSL version, but I don't seem to be having any timeouts. Edit: I have also tried with and without a client ID.
|
Additional info: I tried using a different Spotify premium account and the same result. I am running the LMS add-on in HA, but there were some plugin updates earlier today - although I'm not sure which ones! I always just click them through without paying much attention :( it was working fine, then it all just stopped. Edit: running on Pi 5 Edit 2: Server info copy and paste:
|
You only post a log snippet from the auth itself - which seems to succeed. But there's no sign of what you're doing to get the "failed to get access token". Actually: not even that message is part of your log. Did you configure your Client ID for Spotty? And you should update your LMS to 8.5. |
Thanks for the reply! I can't update to 8.5 because the version is tied to the HA add-on. I do have the With log level (you can ignore the last five or so lines because I had manually created the Is there a keyword I can search for for the token attempt? I suspect it's not even trying, hence it fails for multiple Spotify Premium accounts. So you can see nothing unimportant got stripped out here is the code I used to strip it: var lines = File.ReadAllLines(@"C:\Users\joshc\Downloads\server (6).log").AsEnumerable();
foreach (var key in new[] {
"playlistEntryIsValid",
"doesn't exist on disk - skipping!",
"getBulkMetadata",
"getMetadataFor",
"spotify:track",
"This is a standalone player with Spotify Connect disabled",
})
{
lines = lines.Where(l => !l.Contains(key));
}
foreach (var key in
@" album =>
artist =>
bitrate =>
cover =>
duration =>
icon =>
originaltype =>
originalType =>
title =>
type =>
url =>".Split('\n').Select(l => l.Replace(" ", @"\s+").Trim()))
{
lines = lines.Where(l => !Regex.IsMatch(l, $"^{key}"));
}
lines = lines.Where(l => !Regex.IsMatch(l.Trim(), @"^(\)|}|\])$"));
File.WriteAllLines(@"C:\Users\joshc\Downloads\server (6) - 2.log", lines); |
Here's everything from a reboot just now, looks like
|
I completely uninstalled LMS, reinstalled it, same issue. I then did that again but renamed the "lms" folder after deletion to ensure total deletion, and it's working. When it works, it always takes a few seconds from clicking on the Spotty icon to it opening. When it wasn't working, it was instant failure. I feel like it somehow got its knickers in a twist and refused to try to get a token again, I just don't know why. |
Hi, it's happened again. I have tried setting a new client ID. I've removed and re-added my user. But it just doesn't seem to try to get a new token anymore. Attached are my full I suspect if I completely uninstall and reinstall LMS it will work again with the same client ID, like last time. But it's only been five days since the last time. Is there somewhere I can go and completely clear the Spotty cache? Edit 1: Should mention I have tried both username/password auth and app auth. App auth doesn't redirect the auth page but does end up with the account showing if I eventually manually go back. When this previously happened, I added an entirely different Spotify account and it still had the problem. Edit 2: Log after setting logging to |
I have found out some more - so my suspicion in my previous posts that the token wasn't even being attempted (hence not in the logs) was correct. If I comment out the rate limit section here: Then I am shown the problem in Spotty: But why would I be exceeding the rate limit is my next question? I play one or two playlists per day - however my Spotify has a LOT of playlists in it - could this be the problem? If I change the client ID to a new one, and leave the rate limit section commented out, I am back in action. I suppose a hacky solution here would be to support multiple client IDs to switch between them when this happens. But I'm curious to know why my rate limit has exceeded twice in one week (although I am assuming that the last problem was the same reason). @michaelherger what log level setting would be best to diagnose this? My debuggy brain smells something around folders. I have a folder called |
Yes, many playlists can be an issue. If you set But I don't understand why they would send you away for more than three hours?!? |
Can't get Spotty to work on LMS, using a family premium account. Worked before of course, although I am having issues for a longer time now. At some point it worked with one player but not the other. piCorePlayer version was 5.0.1 until I updated everything gradually to 8.2.0 in the recent days.
I have serious problems getting Spotty to run at all on LMS and Rpi picoreplayer clients. I've seen the other "can't get access token" issues, but none seemed related and none had 401 Unauthorized error.
I have no idea, what else to try or how my setup could be special causing those errors. Thanks in advanc for any help :).
Software versions
Spotty (v4.9.1)
LMS (8.3.2)
PiCorePlayer (8.2.0)
Error form the logs
Error from server.log:
From the API Call (which is also logged) I can see country=US and local=en_US. I am in Germany, can this be related?
What I did try:
The text was updated successfully, but these errors were encountered: