wizarrrr / wizarr

Wizarr is an advanced user invitation and management system for Jellyfin, Plex, Emby etc.
https://docs.wizarr.dev
MIT License
1.25k stars 86 forks source link

[Bug] | Scan Users not working #330

Closed gerryflux closed 4 months ago

gerryflux commented 7 months ago

Are you using the latest release?

Have you checked a bug report doesn't already exist?

What happened?

The feature is meant to scan for and list all existing Plex users on the server. It instead fails with error 401 and does not produce the list.

Virtualisation

Docker

What operating system are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Firefox, Microsoft Edge

Project Location

Local

Bug Description

Clicking on the "Scan Users" to get the list of users fails, giving the error below: image

Steps to Reproduce

Go to Users section Click on "Scan Users"

Relevant Log Output

wizarr  | 21:54:17 ERROR Exception on /api/users/scan [GET]
wizarr  | Traceback (most recent call last):
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1484, in full_dispatch_request
wizarr  |     rv = self.dispatch_request()
wizarr  |          ^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1469, in dispatch_request
wizarr  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask_restx/api.py", line 404, in wrapper
wizarr  |     resp = resource(*args, **kwargs)
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask/views.py", line 109, in view
wizarr  |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask_restx/resource.py", line 46, in dispatch_request
wizarr  |     resp = meth(*args, **kwargs)
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/flask_jwt_extended/view_decorators.py", line 170, in decorator
wizarr  |     return current_app.ensure_sync(fn)(*args, **kwargs)
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/wizarr/backend/api/routes/users_api.py", line 64, in get
wizarr  |     return global_sync_users_to_media_server(), 200
wizarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/wizarr/backend/helpers/universal.py", line 214, in global_sync_users_to_media_server
wizarr  |     sync_plex_users()
wizarr  |   File "/wizarr/backend/helpers/plex.py", line 279, in sync_plex_users
wizarr  |     plex_users = get_plex_users(server_api_key=server_api_key, server_url=server_url)
wizarr  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/wizarr/backend/helpers/plex.py", line 191, in get_plex_users
wizarr  |     response: list[MyPlexUser] = plex.myPlexAccount().users()
wizarr  |                                  ^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/plexapi/server.py", line 322, in myPlexAccount
wizarr  |     self._myPlexAccount = MyPlexAccount(token=self._token, session=self._session)
wizarr  |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/plexapi/myplex.py", line 124, in __init__
wizarr  |     data, initpath = self._signin(username, password, code, remember, timeout)
wizarr  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/plexapi/myplex.py", line 129, in _signin
wizarr  |     return self.query(self.key), self.key
wizarr  |            ^^^^^^^^^^^^^^^^^^^^
wizarr  |   File "/usr/local/lib/python3.12/site-packages/plexapi/myplex.py", line 239, in query
wizarr  |     raise Unauthorized(message)
wizarr  | plexapi.exceptions.Unauthorized: (401) unauthorized; https://plex.tv/api/v2/user <?xml version="1.0" encoding="UTF-8"?> <errors>   <error code="1001" message="User could not be authenticated" status="401"/> </errors>
PilaScat commented 6 months ago

same

PhantomMantis commented 4 months ago

I confused the issue, this is an issue with your plex token