Add KeyError check
This commit is contained in:
parent
1226cbbf11
commit
913980a027
|
@ -30,6 +30,7 @@ hub:
|
||||||
spawner.environment['NEXTCLOUD_ACCESS_TOKEN'] = access_token
|
spawner.environment['NEXTCLOUD_ACCESS_TOKEN'] = access_token
|
||||||
|
|
||||||
async def refresh_user(self, user, handler=None):
|
async def refresh_user(self, user, handler=None):
|
||||||
|
try:
|
||||||
access_token = self.user_dict[user.name]['access_token']
|
access_token = self.user_dict[user.name]['access_token']
|
||||||
refresh_token = self.user_dict[user.name]['refresh_token']
|
refresh_token = self.user_dict[user.name]['refresh_token']
|
||||||
token_response = self.user_dict[user.name]['token_response']
|
token_response = self.user_dict[user.name]['token_response']
|
||||||
|
@ -40,6 +41,8 @@ hub:
|
||||||
return False
|
return False
|
||||||
print(f'Time is: {now}, token expires: {expires}')
|
print(f'Time is: {now}, token expires: {expires}')
|
||||||
return True
|
return True
|
||||||
|
except KeyError:
|
||||||
|
return False
|
||||||
|
|
||||||
c.JupyterHub.authenticator_class = NextcloudOAuthenticator
|
c.JupyterHub.authenticator_class = NextcloudOAuthenticator
|
||||||
c.NextcloudOAuthenticator.client_id = os.environ['NEXTCLOUD_CLIENT_ID']
|
c.NextcloudOAuthenticator.client_id = os.environ['NEXTCLOUD_CLIENT_ID']
|
||||||
|
|
Loading…
Reference in a new issue