More debug

This commit is contained in:
Micke Nordin 2024-01-15 13:43:55 +01:00
parent 42e360ccec
commit 5ba9e626d3
Signed by untrusted user: Micke
GPG key ID: F53C4CC83EDAB3BE

View file

@ -17,6 +17,7 @@ hub:
from oauthenticator.generic import GenericOAuthenticator from oauthenticator.generic import GenericOAuthenticator
def get_nextcloud_access_token(refresh_token): def get_nextcloud_access_token(refresh_token):
debug = 'NEXTCLOUD_DEBUG_OAUTH' in os.environ
client_id = os.environ['NEXTCLOUD_CLIENT_ID'] client_id = os.environ['NEXTCLOUD_CLIENT_ID']
client_secret = os.environ['NEXTCLOUD_CLIENT_SECRET'] client_secret = os.environ['NEXTCLOUD_CLIENT_SECRET']
@ -30,6 +31,8 @@ hub:
'client_secret': client_secret 'client_secret': client_secret
} }
response = requests.post(url, data=data) response = requests.post(url, data=data)
if debug:
print(response.text)
return response.json() return response.json()
def post_auth_hook(authenticator, handler, authentication): def post_auth_hook(authenticator, handler, authentication):
@ -103,7 +106,7 @@ hub:
c.NextcloudOAuthenticator.allow_all = True c.NextcloudOAuthenticator.allow_all = True
c.NextcloudOAuthenticator.refresh_pre_spawn = True c.NextcloudOAuthenticator.refresh_pre_spawn = True
c.NextcloudOAuthenticator.enable_auth_state = True c.NextcloudOAuthenticator.enable_auth_state = True
c.NextcloudOAuthenticator.auth_refresh_age = 3600 c.NextcloudOAuthenticator.auth_refresh_age = 60
c.NextcloudOAuthenticator.post_auth_hook = post_auth_hook c.NextcloudOAuthenticator.post_auth_hook = post_auth_hook
extraEnv: extraEnv: