Using JWT as an authentication for Login

I am trying to figure out the best way of authenticating a JupyterHub user with JWT. In my particular use case, the client will be first authenticated on a primary website and redirected at a later stage to the JupyterHub proxy (both sites are hosted behind the same domain). The idea would be to completely bypass the JupyterHub login screen and enable the user to access his Notebooks (provided that a valid JWT token is available in the HTTP request’s Authorization header). The JWT token would be generated once the user has logged in to the primary site.

Any pointers/advice on how to implement this would be greatly appreciated! My guess is that I need to write a custom authenticator in order to validate the JWT. However, I am unsure on how to configure the entire process. Thanks!

Note: I am using Django as my service.

There’s a JupyterHub JWT authenticator here:

I don’t have any experience with it.