I need help. My JupyterHub config
GenericOAuthenticator:
client_id: []
client_secret: []
oauth_callback_url: http://jupyter.localhost/hub/oauth_callback
authorize_url: http://keycloak.localhost/realms/local/protocol/openid-connect/auth
token_url: http://keycloak.localhost/realms/local/protocol/openid-connect/token
userdata_url: http://keycloak.localhost/realms/local/protocol/openid-connect/userinfo
logout_redirect_url: https://keycloak.localhost/realms/local/protocol/openid-connect/logout?post_logout_redirect_uri=https://localhost&client_id=[]
login_service: 'keycloak'
username_key: 'preferred_username'
userdata_params:
state: state
scope: ['openid']
This is Keycloak
[org.keycloak.events] (executor-thread-171) type=USER_INFO_REQUEST_ERROR, realmId=[], clientId=null, userId=null, ipAddress=10.42.1.80, error=invalid_token, auth_method=validate_access_token
That is JupyterHub
[I JupyterHub oauth2:102] OAuth redirect: 'http://jupyter.localhost/hub/oauth_callback'
[D JupyterHub base:559] Setting cookie oauthenticator-state: {'httponly': True, 'expires_days': 1}
[I JupyterHub log:186] 302 GET /hub/oauth_login?next=%2Fhub%2F -> http://keycloak.localhost/realms/local/protocol/openid-connect/auth?response_type=code&redirect_uri=http%3A%2F2Fjupyter.localhost%2Fhub%2Foauth_callback&client_id=[]&state=[secret]&scope=openid (@10.42.0.1) 1.46ms
[D JupyterHub log:186] 200 GET /hub/health (@10.42.1.1) 1.51ms
[D JupyterHub log:186] 200 GET /hub/health (@10.42.1.1) 1.53ms
[D JupyterHub reflector:362] pods watcher timeout
[D JupyterHub reflector:281] Connecting pods watcher
[D JupyterHub reflector:362] events watcher timeout
[D JupyterHub reflector:281] Connecting events watcher
[E JupyterHub oauth2:386] Error fetching user data 401 GET http://keycloak.localhost/realms/local/protocol/openid-connect/userinfo:
[E JupyterHub web:1798] Uncaught exception GET /hub/oauth_callback?state=[]&session_state=[]&code=[] (10.42.0.1)
HTTPServerRequest(protocol='http', host='jupyter.localhost', method='GET', uri='/hub/oauth_callbackstate=[]&session_state=[]&code=[]', version='HTTP/1.1', remot
e_ip='10.42.0.1')
Traceback (most recent call last):
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/tornado/web.py", line 1713, in _execute
result = await result
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/oauthenticator/oauth2.py", line 222, in get
user = await self.login_user()
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/jupyterhub/handlers/base.py", line 801, in login_user
authenticated = await self.authenticate(data)
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/jupyterhub/auth.py", line 491, in get_authenticated_user
authenticated = await maybe_future(self.authenticate(handler, data))
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/oauthenticator/generic.py", line 165, in authenticate
user_data_resp_json = await self._get_user_data(token_resp_json)
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/oauthenticator/oauth2.py", line 387, in fetch
raise e
File "/opt/bitnami/miniconda/lib/python3.8/site-packages/oauthenticator/oauth2.py", line 366, in fetch
resp = await self.http_client.fetch(req, **kwargs)
tornado.httpclient.HTTPClientError: HTTP 401: Unauthorized
[D 33.112 JupyterHub base:1342] No template for 500
This only occurs after the second Login and is not related to cookies.
Can you tell which parts of the login flow involve cluster interal communication and which external? I probably forgot a forwarding rule?
If you have a working localhost solution, please share.