GET /api/interests requires auth but the public /geography page calls it anonymously (401) #312

Closed
opened 2026-07-01 21:14:16 +00:00 by spikerj · 1 comment
Owner

Found by the E2E anonymous walk (epic #307) once the suite ran API-connected from https://localhost:4200.

Symptom

Anonymous visitors on the public /geography route always get an empty interest filter: the page's InterestsAdminService.getAll() call to GET /api/interests returns 401.

Root cause

SpikerSoft.Api/Domain/Interests/InterestsController.cs has class-level [Authorize], and the read-only GetAll action has no [AllowAnonymous] override. The write actions (create/update/delete) are correctly role-gated to Admin/Staff, but the list endpoint only returns the public catalog of interest areas (key, display name, icon, sort order) — nothing user-specific.

Fix

Add [AllowAnonymous] to GetAll so the public geography experience can render its interest filter. Write endpoints stay role-gated.

Part of epic #307.

Found by the E2E anonymous walk (epic #307) once the suite ran API-connected from `https://localhost:4200`. ## Symptom Anonymous visitors on the public `/geography` route always get an empty interest filter: the page's `InterestsAdminService.getAll()` call to `GET /api/interests` returns **401**. ## Root cause `SpikerSoft.Api/Domain/Interests/InterestsController.cs` has class-level `[Authorize]`, and the read-only `GetAll` action has no `[AllowAnonymous]` override. The write actions (create/update/delete) are correctly role-gated to Admin/Staff, but the list endpoint only returns the public catalog of interest areas (key, display name, icon, sort order) — nothing user-specific. ## Fix Add `[AllowAnonymous]` to `GetAll` so the public geography experience can render its interest filter. Write endpoints stay role-gated. Part of epic #307.
spikerj added the bug label 2026-07-01 21:14:16 +00:00
Author
Owner

Resolved in spikersoft-backend PR #50 (merged to master). GET /api/interests is now [AllowAnonymous] (public catalog only); create/update/delete remain Admin/Staff-gated. The public /geography interest filter can populate for visitors. Closing.

Resolved in spikersoft-backend PR #50 (merged to `master`). `GET /api/interests` is now `[AllowAnonymous]` (public catalog only); create/update/delete remain Admin/Staff-gated. The public /geography interest filter can populate for visitors. Closing.
Sign in to join this conversation.