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

[BUG] plex token expires, scrobbler requires manual recovery #245

Open
JRFarmer opened this issue Mar 24, 2023 · 2 comments
Open

[BUG] plex token expires, scrobbler requires manual recovery #245

JRFarmer opened this issue Mar 24, 2023 · 2 comments
Labels
monitor Concerning a player monitor

Comments

@JRFarmer
Copy link
Contributor

Probably not a bug, I'm just trying to get clarification on what is expected to happen, or maybe something I need to fix?

Every once in a while my plex token will change, and of course the trakt-scrobbler doesn't know this and the scrobbling of plays from plex doesn't work anymore. When this happens, I do trakts stop, fetch my new plex token and edit the plex_token.txt file, and then trakts start.

Is this the intended recovery path? Is there a way to auto-update the token? I'm not sure if the plex token expired, or if it changes because of something else.

Desktop (please complete the following information):

  • OS and Version: Ubuntu 20.04.5
  • Python Version: 3.8.10
  • Player and Version: Plex Server 1.31.1.6733

To Reproduce

Steps to reproduce the behavior:

  1. Don't know. Wait until plex token changes.
  2. Observe scrobbling is broken and check log files.

Log file

Click to see log contents

2023-03-22 21:06:08,664 - DEBUG - plex - monitor - action=stop_previous
2023-03-22 21:06:08,664 - DEBUG - scrobbler - scrobbler - Scrobbling stop at 97.64% for Gentleman Jack
2023-03-22 21:06:08,910 - INFO - scrobbler - scrobbler - Scrobble stop successful for Gentleman Jack S01E06 at 97.64%
2023-03-23 04:29:13,450 - WARNING - plex - utils - Request failed
2023-03-23 04:29:13,450 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'}
2023-03-23 04:29:13,451 - DEBUG - plex - utils - Response: <Response [401]> <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
2023-03-23 04:29:13,451 - ERROR - plex - monitor - Error while getting data from plex: 401 Client Error: Unauthorized for url: http://localhost:32400/status/sessions

@JRFarmer JRFarmer changed the title [BUG] plex token expires [BUG] plex token expires, scrobbler requires manual recovery Mar 24, 2023
@iamkroot
Copy link
Owner

Interesting, I've never seen Plex tokens expire.
Are you manually signing-out of Plex from the browser? That might invalidate it.
Or it might be some recent change they've implemented, not sure.

Try following the steps listed at Finding an authentication token / X-Plex-Token. You can set the token using trakts plex --token <paste token here>.

@iamkroot iamkroot added question Further information is requested monitor Concerning a player monitor labels Apr 25, 2023
@iamkroot
Copy link
Owner

Hmm it looks like the method we use to get plex tokens is deprecated.

We need to switch to the method here which seems very similar to the trakt authentication flow. Maybe we can unify the two code paths.

@iamkroot iamkroot removed the question Further information is requested label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monitor Concerning a player monitor
Projects
None yet
Development

No branches or pull requests

2 participants