We have a JupyterHub for K8s running on top of an Openstack cloud (NFS’s Jetstream2). One of our admin users recently contacted us that his students were getting a 403 Forbidden message when attempting to log in, even after he added their usernames via the Admin panel, <hub-url>/hub/admin
. We are using the GitHub OAuth authentication mechanism, something that we’re well acquainted with.
After some minor troubleshooting, we realized that, if we add users via the helm chart config.yaml and reinstall the new release, that users no longer get the error 403 message and get redirected to their singleuser JupyterLab server.
As users are able to log in when added via config.yaml, I suspect this is a JupyterHub related issue, not a GitHub OAuth issue.
A separate JupyterHub with a similar config displays the same behavior. They are both running JupyterHub 4.0.2. E.g.:
$ kubectl exec -n jhub <hub-pod> -- jupyterhub --version
4.0.2
We are using helm chart version 3.0.3.
I’ve searched both the jupyterhub/jupyterhub GitHub issues page and these forums for anybody that was experiencing a similar issue, to no avail. Does anybody else have this problem, or know of a cause/fix?
Thanks for reading!
– ana v. e.
(configs and logs below)
Here’s the relevant part of the config, with identifying and irrelevant information redacted:
hub:
config:
Authenticator:
admin_users:
- "admins"
allowed_users:
- "users"
GitHubOAuthenticator:
client_id: "xxx"
client_secret: "xxx"
oauth_callback_url: "<jhub-url>:443/oauth_callback"
JupyterHub:
authenticator_class: github
I decided to set debug.enabled: true
to see if I could gather any useful information from the JHub logs, but I don’t see anything past what you’d expect for an unauthorized user.
Here are the logs from when I add a user via the Admin page showing that the user has been added:
[D 2024-06-14 17:33:18.768 JupyterHub scopes:877] Checking access to /hub/api/users via scope admin:users
[D 2024-06-14 17:33:18.768 JupyterHub scopes:677] Unrestricted access to /hub/api/users via admin:users
[D 2024-06-14 17:33:18.769 JupyterHub roles:281] Assigning default role to User <user>
[I 2024-06-14 17:33:18.771 JupyterHub roles:238] Adding role user for User: <user>
[D 2024-06-14 17:33:18.794 JupyterHub roles:281] Assigning default role to User <user>
When attempting a login with that user:
[I 2024-06-14 17:38:57.449 JupyterHub log:191] 200 GET /hub/login (@<IP>) 1.62ms
[D 2024-06-14 17:38:58.671 JupyterHub log:191] 200 GET /hub/static/favicon.ico?v=<string> (@<IP>) 0.66ms
[D 2024-06-14 17:38:58.937 JupyterHub reflector:362] events watcher timeout
[D 2024-06-14 17:38:58.937 JupyterHub reflector:281] Connecting events watcher
[D 2024-06-14 17:38:59.078 JupyterHub log:191] 200 GET /hub/health (@<clusterIP>) 0.67ms
[I 2024-06-14 17:38:59.744 JupyterHub oauth2:102] OAuth redirect: <hub-url>:443/oauth_callback
[D 2024-06-14 17:38:59.744 JupyterHub base:587] Setting cookie oauthenticator-state: {'httponly': True, 'secure': True, 'expires_days': 1}
[I 2024-06-14 17:38:59.745 JupyterHub log:191] 302 GET /hub/oauth_login?next= -> https://github.com/login/oauth/authorize?response_type=code&redirect_uri=<URI>&client_id=<OAuth-cli-ID>&state=[secret] (@<IP>) 1.18ms
[I 2024-06-14 17:39:00.630 JupyterHub log:191] 302 GET /oauth_callback?code=[secret]&state=[secret] -> /hub/oauth_callback?code=[secret]&state=[secret] (@<IP>) 0.69ms
[D 2024-06-14 17:39:01.079 JupyterHub log:191] 200 GET /hub/health (@<clusterIP>) 0.78ms
[D 2024-06-14 17:39:01.079 JupyterHub log:191] 200 GET /hub/health (@<clusterIP>) 0.75ms
[W 2024-06-14 17:39:01.182 JupyterHub auth:533] User '<user>' not allowed.
[W 2024-06-14 17:39:01.182 JupyterHub base:843] Failed login for unknown user
[W 2024-06-14 17:39:01.182 JupyterHub web:1869] 403 GET /hub/oauth_callback?code=<code> (<IP>): Sorry, you are not currently authorized to use this hub. Please contact the hub administrator.
[D 2024-06-14 17:39:01.182 JupyterHub base:1371] No template for 403
[W 2024-06-14 17:39:01.183 JupyterHub log:191] 403 GET /hub/oauth_callback?code=[secret]&state=[secret] (@<IP>) 448.46ms