From aa09762e4f1c5154ca752671b4a7f3d142ee959f Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 12 Oct 2023 00:39:54 +0200 Subject: [PATCH] basehub: fix bug in profile list filtering influencing a few users I think ths bug led to 500 errors if: - GitHubOAuthenticator was used with the `allowed_teams` filtering of `profile_list` options - A user had been logged in since oauthenticator 15 was used, needed to start a server and arrived to /hub/spawn, and didn't have access to all server options. --- helm-charts/basehub/values.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/helm-charts/basehub/values.yaml b/helm-charts/basehub/values.yaml index e37753cd5c..0a11cdb63d 100644 --- a/helm-charts/basehub/values.yaml +++ b/helm-charts/basehub/values.yaml @@ -764,8 +764,15 @@ jupyterhub: allowed_profiles.append(profile) continue - access_token = auth_state["token_response"]["access_token"] - token_type = auth_state["token_response"]["token_type"] + if "token_response" in auth_state: + access_token = auth_state["token_response"]["access_token"] + token_type = auth_state["token_response"]["token_type"] + else: + # token_response was introduced to auth_state in + # oauthenticator 16, so this is adjusting to an auth_state + # set by oauthenticator 15 + access_token = auth_state["access_token"] + token_type = "token" for allowed_org in allowed_orgs: user_in_allowed_org = await spawner.authenticator._check_membership_allowed_organizations( allowed_org, spawner.user.name, access_token, token_type