Hi all,

I've released a Koha plugin that hands staff over to an external media application (MAM for Koha, announced on the main list: https://lists.katipo.co.nz/archives/list/koha@lists.katipo.co.nz/thread/JHVCBGNEL7TEKZZH3M374WHPTOIHSCAA/). I'd value your eyes on the design, especially the sign-in hand-off, before more libraries depend on it.

The hand-off (code-v2)

The plugin adds a toolbar button (intranet_catalog_biblio_enhancements_toolbar_button) and item entries (intranet_js). Clicking one is a CSRF-protected POST to the plugin's tool method.

The plugin stores a short-lived, single-use initiation bound to the staff session and redirects to the MAM. The MAM binds a fresh browser state and sends the browser back to a fixed Koha URL.

Koha issues an opaque single-use code, stored as a SHA-256 hash with a 60-second lifetime. The MAM exchanges it server-to-server at a plugin API route (/api/v1/contrib/media-manager/exchange), authenticating with a client ID and secret. Only a hash of the secret is stored in Koha, and rotation has an overlap window.

Permissions are re-checked at initiation, completion, and exchange. The response carries the identity, the record/item context, and capabilities derived from Koha permissions; no name, email, or password.

Publishing uses the REST API with OAuth client credentials (RESTOAuth2ClientCredentials) as a dedicated staff user. The MAM never touches Koha's database; the plugin only uses its own tables (initiations, codes, rate limits, audit log).

Protocol details are in the Developer Guide: https://github.com/tahir242/koha-media-manager/blob/main/docs/DEVELOPER_GUIDE.md

I'd especially like feedback on:

  • Whether there's a better hook than intranet_js for item-level actions on the holdings table (I fall back to a button next to Edit when Koha draws no Actions dropdown).
  • The trust model of the exchange endpoint, and anything I've missed.
  • Anything that would make this a candidate for the community plugin list.

To try it, docker compose up -d --build in the repository's demo/ folder gives a configured Koha 26.05 with the plugin.

Replies on this list or in GitHub Discussions are both welcome: https://github.com/tahir242/koha-mam/discussions

Thanks,
Tahir Ali Channa



--
Regards,
Tahir Ali Channa
Mob# +92-334-3532646