Clarify public catalog integration for customer apps

This commit is contained in:
Yared Yemane 2026-11-01 14:09:44 +03:00
parent aa718ae7d0
commit c4892d42e8

View File

@ -2,9 +2,12 @@
## Browse without signing in ## Browse without signing in
The web app exposes `/catalog` and `/catalog/courses/:id` outside the authenticated Public discovery is intended for customer-facing web and mobile learning apps.
admin layout. Visitors to `/` see the catalog; signed-in staff retain their usual The admin panel is a staff application: signed-out visitors to `/` are redirected
dashboard redirect. The staff login page also links to the catalog. to `/login`, and signed-in staff go to their role's default management page.
The admin panel does not host customer catalog pages or use anonymous catalog APIs
for content management. Its course, chapter, lesson, and quiz tools continue to
use authenticated `/api/v1/admin` endpoints.
Anonymous APIs: Anonymous APIs:
@ -21,11 +24,26 @@ question delivery, and completion remain behind the existing learning endpoints
and their authentication/subscription rules. Previewing a premium lesson does not and their authentication/subscription rules. Previewing a premium lesson does not
grant access to it. grant access to it.
The web app uses `VITE_API_BASE_URL` with a trailing `/admin` removed for catalog ### Client app integration
requests. Requests omit cookies and staff authorization. Optionally set
`VITE_LEARNER_APP_URL` to your customer web/mobile sign-in destination to display Use the backend's public API base (for example `https://api.example.com/api/v1`)
a **Sign in to learn** link. Without it, the page directs visitors to their in the customer app, without the `/admin` suffix. No bearer token is required.
learning app. The staff login continues to be labeled **Staff sign in**. Render course highlights from the list response and load the course outline
when a visitor selects a course. For browser requests, omit staff credentials:
```javascript
const apiBase = "https://api.example.com/api/v1";
const response = await fetch(`${apiBase}/catalog/courses?limit=20&offset=0`, {
credentials: "omit",
});
if (!response.ok) throw new Error("Unable to load course highlights");
const { data } = await response.json();
// data.courses, data.total_count, data.limit, data.offset
```
Use `GET /catalog/courses/{id}` on the same base for the published outline.
Customer apps should offer their own learner sign-in flow when visitors choose
to start learning; authenticated playback, quiz, and progress APIs enforce access.
## Install the demo fixture ## Install the demo fixture