jupyterlab-git-oauth
JupyterLab Git extension with OAuth 2.0 Device Authorization Grant for GitLab and GitHub. Designed for Kubeflow Notebooks and JupyterHub environments where users are identified by OIDC/SSO headers rather than local Unix accounts.
What it is
A single pip package that replaces jupyterlab-git with:
- OAuth device flow — authenticate to GitLab and GitHub directly from JupyterLab's status bar; no password or personal access token required
- OIDC author injection — automatically sets git
user.nameanduser.emailfrom the Kubeflow/OIDC user header on every commit - Git credential helper —
git-credential-jupyterlab-oauthlets terminal git operations reuse the same OAuth token without re-prompting - Token refresh — background broker keeps access tokens fresh across long-running notebook sessions
Why it exists
In Kubeflow Notebooks, every pod runs as the same jovyan user, but the actual person is identified by an OIDC header injected by oauth2-proxy (e.g., kubeflow-userid). Stock jupyterlab-git:
- doesn't know how to read OAuth tokens from a JupyterHub-managed store
- uses the pod's Unix identity for git author, not the OIDC user
- has no device flow UI
This package patches the two files that matter (jupyterlab_git/handlers.py, jupyterlab_git/git.py) and bundles a Jupyter Server extension providing the OAuth device flow API.
Fork basis
Forked from jupyterlab-git 0.52.0.
The upstream labextension TypeScript and the fork Python patches are combined into a single installable wheel — no separate installs, no version mismatches.
Features
| Feature | GitLab | GitHub |
|---|---|---|
| Device Authorization Grant (RFC 8628) | ✓ | ✓ |
| Token refresh | ✓ | ✓ |
| OIDC author injection | ✓ | ✓ |
| Status bar widget | ✓ | ✓ |
| Git credential helper | ✓ | ✓ |
Requirements
GitLab
Create an OAuth application (Admin Area → Applications or group/user settings) with:
- Grant type: Device Authorization Code
- Scopes:
read_user,read_repository,write_repository
GitHub
Create an OAuth App (Settings → Developer settings → OAuth Apps) with device flow enabled (check "Enable Device Flow" in app settings).
Installation
pip install jupyterlab-git-oauth
This installs the labextension, the Jupyter Server extension, and the git-credential-jupyterlab-oauth helper into PATH. The server extension auto-enables itself; no jupyter server extension enable step is needed.
Configuration
Set environment variables before starting Jupyter:
| Variable | Default | Description |
|---|---|---|
GITLAB_CLIENT_ID |
(none — GitLab disabled) | GitLab application client ID |
GITLAB_URL |
https://gitlab.com |
GitLab instance URL (for self-hosted: https://gitlab.example.com) |
GITHUB_CLIENT_ID |
(none — GitHub disabled) | GitHub OAuth app client ID |
A provider is only activated when its CLIENT_ID variable is set.
Usage
- Open JupyterLab — the status bar shows "GitLab: Not connected"
- Click the status bar item → a device code is displayed in a dialog
- Open the authorization URL, enter the code → the dialog confirms success
- The status bar turns green; git clone / pull / push work from the JupyterLab UI
Terminal git operations also work without re-prompting. The credential helper is auto-configured on Jupyter Server startup (git config --global credential.helper jupyterlab-oauth).
To disconnect: click the status bar item again and choose Disconnect.
Docker image
FROM your-jupyter-base-image
RUN pip install jupyterlab-git-oauth
ENV GITLAB_CLIENT_ID=your-application-client-id
ENV GITLAB_URL=https://gitlab.example.com
# Optional: ENV GITHUB_CLIENT_ID=your-github-app-client-id
Development setup
Requirements: Python 3.9+, Node.js 20+
git clone https://github.com/stachuzamora/jupyterlab-git-oauth.git
cd jupyterlab-git-oauth
# Install JS dependencies and build the labextension
yarn install
yarn run build:prod
# Install the Python package in editable mode
pip install -e .
# Start Jupyter with provider env vars
GITLAB_CLIENT_ID=abc123 GITLAB_URL=https://gitlab.example.com jupyter lab
To watch TypeScript changes during development:
# Terminal 1
yarn watch
# Terminal 2
jupyter lab
License
BSD-3-Clause — see LICENSE.
Upstream jupyterlab-git is also BSD-3-Clause.
Metadata
Release files for jupyterlab-git-oauth 0.52.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jupyterlab_git_oauth-0.52.5.tar.gz | 1.4 MB | With provenance | Details for jupyterlab_git_oauth-0.52.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jupyterlab_git_oauth-0.52.5-py3-none-any.whl | Python 3 | none | any | Details for jupyterlab_git_oauth-0.52.5-py3-none-any.whl |
Total release size: 3.6 MB
Release files / jupyterlab_git_oauth-0.52.5.tar.gz
| Download URL | jupyterlab_git_oauth-0.52.5.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d13e8e2434cfb8e996616c52ee280228101fb17459df03ec46f335d8e74f97a9
|
|
BLAKE2b-256 checksum How to use checksums |
f2bdf9684cafdad33b68b88d5dff659fc82989440587ded7ba679fdbcef6a2ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logRelease files / jupyterlab_git_oauth-0.52.5-py3-none-any.whl
| Download URL | jupyterlab_git_oauth-0.52.5-py3-none-any.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3145c123a5ea303f3cadbf6ee2f368b711c1f1693713230a7652054c6a71ace8
|
|
BLAKE2b-256 checksum How to use checksums |
c6fed0cf218d842ae95eb005276b533c72d3c83832c2e94e0867a0232f4fef9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logSecurity for jupyterlab-git-oauth 0.52.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jupyterlab_git_oauth-0.52.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.