Repository navigation
Description
Parent epic: #2093
Priority
P0 — First shared Sites and external Widgets release.
User journey
An external website displays a Recoup connection button → fan authorizes Spotify → a configured player becomes available → fan disconnects or continues without music. No Recoup-hosted Site is created.
Acceptance criteria
- Create connection and player configuration resources scoped to an application; Sites consumes those same resources. Keep marketing subscriptions separate from provider authorization.
- Replace hard-coded Recoup-only origin handling with the application registration/session model. Bind OAuth state, PKCE, callback handling, and runtime messaging to the correct session and application.
- Keep provider credentials in the trusted connection/player boundary; expose only necessary connection status and normalized player events to host apps. Never send refresh tokens to building agents or arbitrary host pages.
- Handle browser cookie restrictions, popup denial, token expiry, reconnect, disconnect, Premium eligibility, unsupported playback, and provider outages with recoverable states.
- Offer constrained theme tokens, accessible controls, required attribution, and mobile behavior; fan connection/playback must not require MCP calls.
- Provide configuration and management through API/MCP with capability checks, usage metering where approved, and versioned contracts.
Blocking dependencies
- [Fans] Recognize fans across a customer’s campaigns and connected apps #2111
- [Sites] Meter Sites operations with credit reservations and spending limits #2105
These are completion prerequisites, mirrored in GitHub’s blocked-by links. Design and contract work may start earlier. Other coordination references are not blockers.
Validation
Use two independently hosted test apps and Recoup Sites; verify no identity/session bleed, exact message source/origin checks, callback binding, revocation, and graceful no-music paths.
Delivery conventions
API owns business logic and billing; HTTP and MCP share it. Chat/embeds/SDKs are clients. Database changes use the database repository PR workflow. Update marketing-owned docs and generated indexes. Use Vercel Workflows for new durable background work. No automatic publication or unbounded customer spending.
Shared callback design
Spotify returns to a fixed Recoup-owned callback registered for the configured Spotify application. Customer websites are registered with Recoup, not added individually to Spotify's callback list. This must work independently of website-builder brand.
- Create a short-lived, single-use connection request bound to the application, environment, initiating browser, provider configuration, and previously registered return destination. Validate OAuth state and PKCE; reject expired, replayed, or mismatched responses.
- Keep customer return addresses separate from the Spotify callback. Select only registered destinations; never redirect to an arbitrary user-supplied URL. Do not place provider credentials in return URLs or host-page messages.
- Support a popup path that signals completion to the correct trusted Recoup player using exact window/origin checks, and a full-page path that returns through Recoup with a short-lived, single-use handoff bound to the initiating browser.
- Support completion without relying on third-party cookies or an intact popup opener. Use a request-bound completion check when window messaging is unavailable; a public request identifier alone must not grant access.
- Keep provider credentials inside the trusted Recoup service/player boundary; the customer page receives only the scoped connection status and supported player events.
- Allow an authorized customer's agent to register exact production and preview origins/return destinations through the Recoup API/MCP. Avoid shared-host wildcard permissions and provide revocation.
- Test two unrelated customer domains, a new preview domain, blocked popups, lost opener, restricted cookies, mobile redirects, concurrent tabs, callback replay, and attempted destination substitution. Adding a customer domain must not require editing the Spotify callback list.
For customer-owned Spotify registrations, the fixed Recoup callback must be registered once in each configured provider application; it is still not registered per customer website. Compatibility depends on browser/embed capabilities, not a hard-coded list of builder names.
Approved category and ownership
Split responsibility explicitly: Fans owns identity, sign-in sessions, and fan-authorized provider connections; Widgets owns Spotify Sign-in and Webplayer presentation/runtime. Keep the shared Recoup callback design. Recoup Sites consumes the same Fans services and Widgets as external apps.
Parent epic #2093 defines Sites, Fans, and Widgets. Use those names in public documentation and MCP descriptions. Preserve existing functional requirements, dependencies, and authorization/billing boundaries.
Initial capability contract
Deliver versioned technical availability and recoverable errors for configured/unconfigured provider access, Premium eligibility, token expiry, denied scopes, and unsupported playback here. Expose these through API/MCP and Widgets so #2108 and #2109 can ship without waiting on the broader #2106 research. Reuse #2111 identity/session contracts and #2105 customer billing.
Website sign-in is distinct from Spotify connection — P0
- Implement [Fans] Recognize fans across a customer’s campaigns and connected apps #2111's two journeys: Recoup establishes a new host sign-in, or links Spotify to an existing verified host user. Keep host identity, provider connection and playback eligibility as separate states.
- Before implementation, document whether the initial integration uses a standard identity-provider protocol or a custom server-verified, short-lived single-use exchange. State supported capabilities honestly; an OAuth connection or player status event alone is not proof of host login.
- Bind sign-in completion to the initiating application, environment, browser/request and registered return destination. The trusted host establishes its own session only after verification. No provider refresh tokens or reusable login credentials in host messages or return URLs.
- Document logout/disconnect semantics and recovery using [Fans] Recognize fans across a customer’s campaigns and connected apps #2111. Include backend and static-host integration requirements in API/MCP descriptions and [Widgets] Make installation discoverable and testable by building agents #2109 agent recipes.
Shared visual design contract
- Expose constrained theme tokens for typography, palette, spacing, surface shape and supported motion so sign-in and Webplayer fit a release or customer website. Keep trusted behavior, recognizable provider attribution, readable contrast and clear service identity intact; customers cannot restyle the provider-hosted authorization screen through Recoup.
- Make connection, loading, playback, reconnect/error and no-music states visually consistent and usable on phones. Respect safe areas and reduced motion; provide placement/size behavior that keeps player controls from covering the host experience.
- Recoup Sites consumes the same theme contract as external apps. The generated design brief may select allowed tokens, but generated code cannot replace trusted login or access credentials. Document limits and fallback styles for agent integrations.
Coordinate generation/visual critique with P1 #2094; it is not a prerequisite for these shared responsive Widget requirements.
Activity
[-][Sites] Extract reusable connection and player services from the Sites app[/-][+][Widgets] Extract Spotify Sign-in and Webplayer backed by shared Fans services[/+]sidneyswift commentedon Oct 31, 2026
Released a narrow keyboard-focus repair in #2386, merged as
198bfca2bed541c69401d4a1e203b03c0234148e.On the credential-free white-host fixture at actual Chrome 200% zoom, keyboard Minimize returns focus to the music launcher with
:focus-visibleactive, a blue outer outline and a visible white inset ring. Enter reopens the player with the synthetic game score preserved. This supplies bounded evidence for accessible controls here and the keyboard-focus/progress-preservation requirements in #2097.The accepted candidate and merge have identical trees. All four post-merge workflows passed, and the normal production deployment is READY at that exact merge with the canonical app domain bound directly to it. This deployment receipt is separate from the local native interaction evidence.
This does not establish full accessibility, forced-colors behavior, real Spotify playback, or the remaining external-app/authentication acceptance matrix. The separate #2345 hold remains in effect. No broad acceptance checkbox is marked complete by this update.
sidneyswift commentedon Nov 6, 2026
Shipped so far: a reusable release player with registered embed origins, signed provider-bound sessions and PKCE (recoupable/api#993, #2181), stricter signed-session checks (recoupable/api#1206), and Sites player focus and recovery fixes (#2380, #2386, #2387).
Still open: connection and player resources tied to registered applications (#2104), callbacks bound to registered return destinations, host sign-in kept separate from Spotify connection (#2111), theme tokens, and an API/MCP capability contract.
Sites still runs its own player path, so the "same primitives" requirement is not met yet.