Jupyter-server keeps asking for token login

Ī™ have set up a jupyter server instance on kubernetes. The login prompt screen is the following

enter image description here

I exec into the pod, run jupyter notebook list, and in the two boxes at the bottom of the screenshot I enter the token returned by the above command and a password.

I then log in, log out and I am prompted again with the same screen

When I insert the password / token I created in the previous step in the Password or token field at the top of the screen, I get an invalid credentials response.

How can I set up a password-only authentication?

The links in the screenshot point to 404 pages.

jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.1.4
qtconsole        : not installed
ipython          : 7.18.1
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : 2.2.8
nbconvert        : 6.0.7
ipywidgets       : 7.5.1
nbformat         : 5.0.7
traitlets        : 5.0.4

You can run the command

jupyter server password

(or in your case, since you appear to be using the older notebook server, jupyter notebook password).

It will prompt for your password, and then create (or add to) a config file (jupyter_server_config.json for the new server, jupyter_notebook_config.json for the old one).

If you add JUPYTER_CONFIG_DIR=$PWD, then it will create this file in your current directory. You can then add this file to your container, and password authentication will be enabled with the password you specified.

For the full command (Iā€™m using jupyter server):

$ JUPYTER_CONFIG_DIR=$PWD jupyter server password
Enter password:
Verify password:
[JupyterPasswordApp] Wrote hashed password to ./jupyter_server_config.json
$ cat jupyter_server_config.json
{
  "IdentityProvider": {
    "hashed_password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$4wUfa8Ikw4hqftKpmYbgLA$QC/iREH2JhL9MV95Uqr5X6CVipzYdFfgS1TGtuy1Hlc"
  }
}

You can add this file via a secret volume to your container, e.g. mounting it in /etc/jupyter/jupyter_server_config.json

Again, if you are using the legacy notebook server, replace server with notebook in filenames and commands above.

1 Like