Contribute sign-in login options as data through a user_auth backend hook
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
External auth plugins contribute login options to the sign-in page (the OIDC client's button), but a plugin's button never renders — the registry lives outside cross-bundle webpack externals. The fix that made it render moved the registry into the core JS API, a plugin-specific detail in a global core contract.
Move the mechanism into user_auth: login options are contributed as data through a backend hook, delivered on the existing plugin_data channel. Noop when user_auth is inactive; nothing login-specific in core.
Complexity: Medium Target branch: develop
Context
Current mechanism
packages/kolibri-common/utils/loginComponents.js— an array with a.register()method.AuthBase.vuerenders[...loginComponents]via<component :is>.- A plugin injects its login bundle via
UserAuthSyncHook(user_auth-owned) →user_auth.html's{% user_auth_assets %}.
Why the button never renders
- Cross-bundle externals cover only the core
kolibripackage'sexports.kolibri-commonisn't covered, so each independently-built bundle gets a private copy of the array; the plugin's.register()never reachesAuthBase's copy.
Constraints on the fix
- CSP forbids inline scripts — the backend can't inject a
<script>to register. plugin_dataalready reaches the frontend as inert<template data-plugin>JSON (kolibri/core/webpack/hooks.py), read viakolibri-plugin-data— CSP-safe.
The Change
A login option is data, not behaviour: the OIDC button is a KExternalLink to /oidcauthenticate/ with a label, SVG icon, and button appearance — no client-side logic.
user_authdefines a backend hook (e.g.LoginItemHook). A plugin registers a subclass declaring: label (resolved server-side via Django i18n), login URL, icon static-asset URL, button appearance.user_auth'splugin_dataaggregates registered items intologinItems, delivered on the existing<template data-plugin>channel.AuthBase.vuereadsplugin_data.loginItemsand renders oneKExternalLinkper item;user_authowns the presentation.- Remove
kolibri-common/utils/loginComponents.jsand the<component :is>rendering. - Convert the OIDC client plugin to the hook and remove its frontend.
- Bump the OIDC plugin's minimum Kolibri version (now depends on
user_authexposing the hook).
Out of Scope
- The OIDC provider flow (
OIDCProviderHook/oidcProviderEnabled) — unrelated concern, unchanged. - Login-item ordering/sorting — one item today; add a sort key when a second appears.
- Arbitrary interactive login components — options are link/button data only.
Acceptance Criteria
Mechanism (user_auth)
- [ ]
user_authexposes a backend hook that collects login options as data (label, login URL, icon URL, appearance). - [ ] Registered items surface in
user_auth'splugin_data.loginItems, delivered via the<template data-plugin>channel — no inline script. - [ ]
AuthBase.vuerenders oneKExternalLinkperloginItemsentry, styled byuser_auth. - [ ] Labels display translated in the request's active language.
- [ ] With no items registered,
AuthBase.vuerenders no login options. - [ ] When
user_authis inactive, the hook is a noop — undefined, no error. - [ ]
packages/kolibri-common/utils/loginComponents.jsand the<component :is>login rendering are removed. - [ ] Nothing login-item-specific is added to the core
kolibriJS API.
OIDC client plugin
- [ ] The login button renders on the sign-in page and completes login against a real provider.
- [ ] The plugin contributes its option through the new hook;
OIDCLogin.vueis removed. - [ ] The icon is served as a static asset and shown on the button.
- [ ] The plugin's
package.jsonis removed. - [ ] The
LoginItemwebpack bundle hook is removed. - [ ] The
LoginItemInclusionHookbundle-inclusion hook is removed. - [ ] The plugin is removed from the pnpm workspace.
- [ ] The
browserslistconfig is removed. - [ ]
pnpm-lock.yamlis regenerated. - [ ] The plugin no longer participates in the pnpm/webpack frontend build.
- [ ] Minimum Kolibri version bumped to the release exposing the hook.
Testing
- [ ] Backend: registering a login-item hook surfaces it in
user_auth'splugin_data.loginItems. - [ ] Frontend:
AuthBase.vuerenders a link perloginItemsentry, and none when empty.
References
- PR #14955 — OIDC client migration; introduced then reverted the core-JS-API fix this replaces.
- Design rationale — user_auth-owned hook, CSP constraint.
AI usage
AI-assisted with Claude Code — codebase exploration and issue drafting.
Plan: Replace the broken kolibri-common/utils/loginComponents.js cross-bundle registry with a user_auth-owned backend hook (LoginItemHook) that delivers login-option data over the existing CSP-safe plugin_data channel, and migrate the OIDC client plugin to use it.
- [ ] Define
LoginItemHook - [ ] Aggregate
LoginItemHookintoUserAuthAsset.plugin_data - [ ] Simplify pass (Phase 1)
- [ ] Render
loginItemsfromplugin_data - [ ] Simplify pass (Phase 2)
- [ ] Extract the icon to a static asset, register
LoginItemHook, delete the old frontend - [ ] Bump the minimum Kolibri version and package the icon into the wheel
- [ ] Simplify pass (Phase 3)
- [ ] Drop pnpm workspace membership and regenerate the lockfile
- [ ] Simplify pass (Phase 4) and final full-suite check
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
@rtibbles can i work on this issue as i see its has various parts
Hi! 👋
Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.
We really appreciate your willingness to help. 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.