mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Force refresh Plex.tv token in settings
* Removes the old PlexPy device and fetches a new token
This commit is contained in:
parent
73ac4076ac
commit
0b10e68c60
5 changed files with 115 additions and 20 deletions
|
@ -3086,8 +3086,8 @@ class WebInterface(object):
|
|||
if not username and not password:
|
||||
return None
|
||||
|
||||
token = plextv.PlexTV(username=username, password=password)
|
||||
result = token.get_token()
|
||||
plex_tv = plextv.PlexTV(username=username, password=password)
|
||||
result = plex_tv.get_token()
|
||||
|
||||
if result:
|
||||
return result['auth_token']
|
||||
|
@ -3095,6 +3095,24 @@ class WebInterface(object):
|
|||
logger.warn(u"Unable to retrieve Plex.tv token.")
|
||||
return None
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def get_plexpy_pms_token(self, username=None, password=None, force=False, **kwargs):
|
||||
""" Fetch a new Plex.tv token for PlexPy """
|
||||
if not username and not password:
|
||||
return None
|
||||
|
||||
force = True if force == 'true' else False
|
||||
|
||||
plex_tv = plextv.PlexTV(username=username, password=password)
|
||||
token = plex_tv.get_plexpy_pms_token(force=force)
|
||||
|
||||
if token:
|
||||
return {'result': 'success', 'message': 'Authentication successful.', 'token': token}
|
||||
else:
|
||||
return {'result': 'error', 'message': 'Authentication failed.'}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue