mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 23:13:00 +00:00

For ordinary users to access the service, they need an appropriate scope added to the user role. This adds that role in the jupyterhub_config.py, as well as a note about this in the README. It also updates the ouptut that comes form the whoami service.
1.1 KiB
1.1 KiB
Authenticating a flask service with JupyterHub
Uses jupyterhub.services.HubOAuth
to authenticate requests with the Hub in a flask application.
Run
-
Launch JupyterHub and the
whoami service
withjupyterhub --ip=127.0.0.1
After logging in with your local-system credentials, you should see a JSON dump of your user info:
{
"admin": false,
"groups": [],
"kind": "user",
"name": "queequeg",
"scopes": [
"access:services!service=whoami",
"read:users:groups!user=queequeg",
"read:users:name!user=queequeg"
],
"session_id": "a32e59cdd7b445759c58c48e47394a38"
}
This relies on the Hub starting the whoami service, via config (see jupyterhub_config.py). For ordinary users to access this service, they need to be given the appropriate scope (again, see jupyterhub_config.py).
A similar service could be run externally, by setting the JupyterHub service environment variables:
JUPYTERHUB_API_TOKEN
JUPYTERHUB_SERVICE_PREFIX