A JupyterLab extension for authentication.
This extension is composed of a Python package named jupyterlab-auth
for the server extension and a NPM package named jupyterlab-auth
for the frontend extension.
To install the extension, execute:
mamba create -n jupyterlab-auth-dev
conda activate jupyterlab-auth-dev
mamba install pip nodejs
wget -q https://github.com/jupyterlab/jupyterlab/archive/master.tar.gz -O jlab.tar.gz
tar zxf jlab.tar.gz
cd jupyterlab-master
pip install -e .
jlpm
jlpm build
cd ..
pip install -e .
jupyter labextension develop . --overwrite
jupyter server extension enable jupyterlab-auth
jlpm
jlpm run build
jupyter server extension list
jupyter labextension list
jupyter lab build
pip install https://github.com/Zsailer/jupyter_server/archive/authorization.zip
jupyter lab --dev-mode --extensions-in-dev-mode --collaborative
You will need to authorize JupyterLab to access your GitHub information. We only need the
read:user
scope, which grants access to read a user's profile data (see the
available scopes).
You can register a new OAuth application here:
- Application name: JupyterLab
- Homepage URL: http://localhost:8888
- Authorization callback URL: http://localhost:8888/auth/github
localhost
and 8888
are the IP and port number, respectively. You might have to change them
according to your particular setup.
This will generate a client ID for you, and you must also generate a client secret.
When navigating to the Jupyter server (either because JupyterLab automatically opens a new tab in your browser or by manually going to e.g. http://localhost:8888), you should land to the login page, where you can enter your client ID and secret. After authentication, you should be allowed access and redirected to JupyterLab.
Try opening e.g. http://localhost:8888 in another browser. Here again, you have to provide your client ID and secret. It is fine if they are the same as before, you will just be authenticated as the same user. You can see the connected users by opening the tab on the left. Also, when you see the cursor of another user in a notebook cell, you can place your mouse over it and it should show you the user name.
You can log out by navigating to e.g. http://localhost:8888/logout, or by clicking on your user login in the menu (on the right), and then "Sign out".