JupyterLab not leveraging custom authenticator

We want to use a custom JWT authenticator instead of a random token or password, but JupyterLab does not leverage it when the URL is accessed. This works fine in TLJH but not on a base JupyterLab installation (i.e. pip install jupyterlab). Following is what I have in my jupyter_lab_config.py file:

c = get_config()  #noqa

c.JupyterHub.authenticator_class = 'jwtauthenticator.jwtauthenticator.JSONWebTokenAuthenticator'

c.JSONWebTokenAuthenticator.userid_claim_field = "custom:userid"
c.JSONWebTokenAuthenticator.auth_url = "https://auth.url.com"
c.JSONWebTokenAuthenticator.cookie_name = "id_token"
c.JSONWebTokenAuthenticator.client_id = "clientId"
c.JSONWebTokenAuthenticator.auth0_default_region = "us"
c.JSONWebTokenAuthenticator.tenant_id = "tenantId"
c.JSONWebTokenAuthenticator.redirect_url = "https://redirect.url.com"
c.IdentityProvider.token = ''

When trying to load the JupyterLab site from a private browser window, I expect to be redirected to Auth0 for authentication. Instead, it’s as if the authenticator is being ignored and the page just loads.

I’m assuming there’s some setting in my config that I’m missing.

I dont think what you are attempting is possible just with vanilla JupyterLab. The config you posted only works with JupyterHub. There is no traitlet authenticator_class on JupyterLab.

JupyterHub was created exactly for this reason: authenticate users from different auth sources and spawn JupyterLab instances in multi tenant environment. I dont think you can configure custom auth on JupyterLab.

@mahendrapaipuri - I see. Thank you for clearing that up!

1 Like