mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Fix credentials to connect
This commit is contained in:
parent
43b34eb530
commit
3525577dfc
3 changed files with 9 additions and 6 deletions
|
@ -669,6 +669,7 @@ class ConnectionManager(object):
|
||||||
credentials = self.credentialProvider.getCredentials()
|
credentials = self.credentialProvider.getCredentials()
|
||||||
credentials['ConnectAccessToken'] = result['AccessToken']
|
credentials['ConnectAccessToken'] = result['AccessToken']
|
||||||
credentials['ConnectUserId'] = result['User']['Id']
|
credentials['ConnectUserId'] = result['User']['Id']
|
||||||
|
credentials['ConnectUser'] = result['User']['DisplayName']
|
||||||
self.credentialProvider.getCredentials(credentials)
|
self.credentialProvider.getCredentials(credentials)
|
||||||
# Signed in
|
# Signed in
|
||||||
self._onConnectUserSignIn(result['User'])
|
self._onConnectUserSignIn(result['User'])
|
||||||
|
|
|
@ -201,15 +201,17 @@ class ConnectManager(object):
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("User is not authenticated")
|
raise RuntimeError("User is not authenticated")
|
||||||
|
|
||||||
def update_token(self, servers, server):
|
def update_token(self, server):
|
||||||
|
|
||||||
credentials = self._connect.credentialProvider.getCredentials()
|
credentials = self._connect.credentialProvider.getCredentials()
|
||||||
updated_server = self._connect.credentialProvider.addOrUpdateServer(servers, server)
|
self._connect.credentialProvider.addOrUpdateServer(credentials['Servers'], server)
|
||||||
|
|
||||||
for server in self.get_state()['Servers']:
|
for server in self.get_state()['Servers']:
|
||||||
if server['Id'] == updated_server['Id']:
|
for cred_server in credentials['Servers']:
|
||||||
|
if server['Id'] == cred_server['Id']:
|
||||||
# Update token saved in current state
|
# Update token saved in current state
|
||||||
server.update(updated_server)
|
server.update(server)
|
||||||
|
log.info(self.get_state())
|
||||||
# Update the token in data.txt
|
# Update the token in data.txt
|
||||||
self._connect.credentialProvider.getCredentials(credentials)
|
self._connect.credentialProvider.getCredentials(credentials)
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class InitialSetup(object):
|
||||||
# Update token
|
# Update token
|
||||||
server['UserId'] = settings('userId') or None
|
server['UserId'] = settings('userId') or None
|
||||||
server['AccessToken'] = settings('token') or None
|
server['AccessToken'] = settings('token') or None
|
||||||
self.connectmanager.update_token(current_state['Servers'], server)
|
self.connectmanager.update_token(server)
|
||||||
|
|
||||||
server_address = self.connectmanager.get_address(server)
|
server_address = self.connectmanager.get_address(server)
|
||||||
self._set_server(server_address, server)
|
self._set_server(server_address, server)
|
||||||
|
|
Loading…
Reference in a new issue