GitHub user names and RTC-enabled Notebooks

We have a JupyterHub deployment that authenticates users with GitHub. I am working on trying to get the GitHub user names to show up next to the cursors in RTC-enabled Notebooks. Is anyone aware of an already existing implementation of this?

In JupyterLab 4, everything related to identity will be changing.

In the meantime, here is an example of a custom docprovider for JupyterLab 3:

While the whole implementation might be overkill (one-doc-many-kernels has its own challenges), one could restore using the built-in @jupyterlab/docprovider, but replace the way it currently resolves username (URL param, settings, custom jupyter-config-data field) with reading it from some other place in the config that contained the name.


@bollwyvl In JL4 will webrtc be the transport mechanism for yjs (e.g. shared documents)? The root of my question is that I’m wondering about how big I might reasonably expect the collaboration to scale, I would expect with the p2p of webrtc this would mean it wouldn’t scale very high (e.g. one of my many use cases, a classroom of 100+). Is there a design doc for JL4 per chance?

Longer story, we are building in some more identity features to JL and it would be great to contribute as opposed to deviate from the intended product line :slight_smile:


1 Like

JL4 will webrtc be the transport mechanism for yjs

Only if you install that linked extension: core will continue to do… whatever it’s doing. Really a lot going on there.

Definitely not pushing that linked WebRTC provider as having MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE: it was extracted from jupyterlite as it was a way to leverage free (as in beer) signaling-servers-of-opportunity. To my knowledge, it has only been evaluated for small demos.

At scale, I imagine an yjs-xmpp-powered provider backed with ejabberd would probably be the most robust: a server NIC will give out before that piece of code will, and presumably the yjs piece will support it well.

deviate from the intended product line

This little post isn’t likely to give you the detail you want, and I definitely don’t know all the stuff. You’ll want to track:

1 Like

Thanks, very helpful!

It appears that if I set a cookie containing the name of the GitHub user at the time of authentication, it can be effectively used in order to set the user’s name using awareness.setLocalStateField when each Notebook starts.

def post_auth_hook(
    authenticator: GitHubOAuthenticator, 
    handler: OAuthCallbackHandler, 
    authentication: dict


    return authentication

c.GitHubOAuthenticator.post_auth_hook = post_auth_hook