Thanks, I had overlooked that it is only for API use.
I also had to add ‘oauth_no_confirm’: True
in the c.JupyterHub.services
block.
Now I’m rebuilding one of my own sites and ran into the same problem as here.
class ThingsHandler(HubOAuthenticated, BaseHandler, ABC):
@authenticated
def get(self):
user = self.get_current_user()
auth_state = user.get_auth_state()
# Retrieve information from auth_state and generate information to be displayed to the user
# .......
html = self.render_template(
'things_list.html',
auth_state=auth_state,
user=user,
things_list=things_list,
is_generated_error=is_generated_error
)
self.finish(html)
2024-05-31 12:24:29 Uncaught exception
2024-05-31 12:24:29 Traceback (most recent call last):
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/http1connection.py", line 276, in _read_message
2024-05-31 12:24:29 delegate.finish()
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/routing.py", line 268, in finish
2024-05-31 12:24:29 self.delegate.finish()
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 2399, in finish
2024-05-31 12:24:29 self.execute()
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 2421, in execute
2024-05-31 12:24:29 self.handler = self.handler_class(
2024-05-31 12:24:29 ^^^^^^^^^^^^^^^^^^^
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 232, in __init__
2024-05-31 12:24:29 self.clear()
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 333, in clear
2024-05-31 12:24:29 self.set_default_headers()
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py", line 246, in set_default_headers
2024-05-31 12:24:29 self.set_header('Content-Security-Policy', self.content_security_policy)
2024-05-31 12:24:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py", line 222, in content_security_policy
2024-05-31 12:24:29 ["frame-ancestors 'none'", "report-uri " + self.csp_report_uri]
2024-05-31 12:24:29 ^^^^^^^^^^^^^^^^^^^
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py", line 208, in csp_report_uri
2024-05-31 12:24:29 'csp_report_uri', url_path_join(self.hub.base_url, 'security/csp-report')
2024-05-31 12:24:29 ^^^^^^^^
2024-05-31 12:24:29 File "/usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py", line 168, in hub
2024-05-31 12:24:29 return self.settings['hub']
2024-05-31 12:24:29 ~~~~~~~~~~~~~^^^^^^^
2024-05-31 12:24:29 KeyError: 'hub'
But if I don’t use the BaseHandler
but the RequestHandler
I can’t access the auth_state
of the user and it can’t render a jinja2 template
.
tornado.template.ParseError: unknown operator: 'endblock' at things_list.html:5