Update jersey and checkout pages to support session auth without token #198
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/westside-app#198
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Child of
forgejo_admin/westside-landing#196(spike: player self-service jersey ordering).Depends on: backend dual-auth ticket (basketball-api).
Story: WS-S18
Repo
forgejo_admin/westside-landingUser Story
As a logged-in parent
I want the jersey and checkout pages to work with my Keycloak session
So that I don't need the email token link to complete an order
Context
The jersey page (
jersey/+page.svelte) and checkout page (checkout/+page.svelte) currently require a?token=URL param and use rawfetch()(notapiFetch) for API calls. If no token is present, they show an "Invalid Link" error.For session-based flow, these pages need a second entry mode:
?player_id=123with Keycloak Bearer auth viaapiFetch. The existing token flow must remain untouched.Key code paths to modify:
jersey/+page.svelteline 110-111: token extraction from URLjersey/+page.svelteline 206: rawfetch()call to/jersey/checkout?token=...checkout/+page.svelteline 27-28: token extraction from URLcheckout/+page.svelteline 86: rawfetch()call to/checkout/create-session?token=...File Targets
Files the agent should modify or create:
src/routes/(app)/jersey/+page.svelte— addplayer_idURL param support; useapiFetchwhen in session mode; replace "Invalid Link" with signin redirect when session mode and not authenticatedsrc/routes/(app)/checkout/+page.svelte— same changes as jersey pageFiles the agent should NOT touch:
src/routes/(app)/jersey/success/+page.svelte— unrelatedsrc/routes/(app)/jersey/cancel/+page.svelte— unrelatedsrc/routes/(app)/checkout/success/+page.svelte— unrelatedsrc/routes/(app)/checkout/cancel/+page.svelte— unrelatedAcceptance Criteria
/jersey?player_id=5while logged in, then the jersey page loads using Keycloak session auth/jersey?token=abc123, then the existing token flow works unchanged/jersey?player_id=5while NOT logged in, then I'm redirected to/signin/checkout?player_id=5&category=jerseywhile logged in, then checkout works with session auth/checkout?token=abc123&category=jersey, then existing token flow works unchangedapiFetch(which injects Bearer token from Keycloak)Test Expectations
?player_id=while authenticated?token=(existing flow)?player_id=redirects to signinnpm run build(SvelteKit build check)Constraints
apiFetchfrom$lib/api.jsandisAuthenticatedfrom$lib/keycloak.jsfor session modefetch()(no Keycloak dependency for email-link users)Checklist
Related
westside-basketball— project this affectsforgejo_admin/westside-landing#196— parent spike issue