Description
Bug description
In our Jupyterhub setup with get a Refresh Token from OIDC that is long-lived, e.g. 24 hours. That can be exchanged for a short-lived (5 minutes) ID token.
We upgraded from OAuthenticator from 16.3.1 to 17.3.0 and started seeing "Unable to decode id token" pretty often.
Digging into the code it seems like the problem comes from the fact that OAuthenticator now implements refresh_user
API from Jupyterhub's Authenticator class. The base implementation (that was used in 16.3.1) just returns true; new implementation (in 17.3.0) calls into _token_to_auth_model
, which tries to parse out id token inside token_to_user
. Since ID token is likely expired at this point - the singleuser pod spin up fails.
To work around this I just went back to the original behavior of returning True
all the time from refresh_user
.
How to reproduce
- Go to hub, since you haven't been authenticated yet - it will redirect you to the OIDC provider, after signing on there you will be redirected to the hub and establish a session.
- Spin up a singleuser pod, wait long enough for the id token to expire (but NOT refresh token) and shut down your singleuser pod.
- Go back to the hub, try to spin up your singleuser pod again.
- See error
Expected behaviour
During the refresh_user
workflow the fact that id token expired shouldn't cause the refresh to halt. The id token isn't used for anything in the refresh_user
flow anyway, e.g. the actual refreshing happens using refresh token.
Actual behaviour
Because the code is structured in a way that ends up parsing id token and the token is expired, this causes the entre reresh_user
method to fail.
Your personal set up
- OS: Linux jupyterhub-apol-hub-7ddbc55c6-tlbrz 6.1.129
- Version(s): jupyterhub 5.2.1, Python 3.11.9
# paste output of `pip freeze` or `conda list` here
Configuration
jupyter-events==0.12.0
jupyter-telemetry==0.1.0
jupyterhub==5.2.1
jupyterhub-firstuseauthenticator==1.0.0
jupyterhub-hmacauthenticator==1.0
jupyterhub-idle-culler==1.3.1
jupyterhub-kubespawner==6.2.0
jupyterhub-ldapauthenticator==1.3.2
jupyterhub-ltiauthenticator==1.6.2
jupyterhub-nativeauthenticator==1.2.0
jupyterhub-tmpauthenticator==1.0.0
jupyterhub-traefik-proxy==2.1.0
oauthenticator==17.3.0
oauthlib==3.2.2