Search code examples
jupyter-notebookjupytergoogle-colaboratory

How to enable token authentication in Jupyter Notebook?


I am running Juypter Notebook version 6.0.0 on a remote server. There is password authentication in place and according to the docs if this is so then token authentication is disabled. However I need to enable token authentication so I can set up Google Colab(which requires token based authentication) with a local runtime on the remote server. While there are several links describing how to disable authentication, I couldn't find any on how to enable it.

The output of jupyter notebook list does not show any tokens. Even resetting the password does not generate a token.


Solution

  • I see that your notebook provider has disabled tokens. In this doc the steps to disable token is given, so I applied exactly opposite steps and it worked. Since you have a remote server, if you somehow manage to restart jupyter notebook remotely, then you can do the same.

    Steps:

    • Edit the config file, jupyter_notebook_config.json

    • Add this line to the config, as in the picture

      "token": "YOUR_TOKEN",

    • You can use token consisting of hex characters (0-9, a-f) as a token

    • Remove the line that contains password

    • Now you need to restart the server

    • Exit by clicking 'Quit'

    • After you log back next time, give the token instead

    editing config file

    Location of config file:

    Windows: "C:\Users\Username\.jupyter\"
    
    Linux: "/home/user/.jupyter"