Skip to content

Commit 1e68a0b

Browse files
authored
feat(sdk): accept optional appToken on /api/sdk/v1/install (#24)
Adds `appToken: z.string().optional()` to the install endpoint's request schema. Self-hosted single-tenant deployments accept the field and ignore it — no behavior change. Cloud uses it (via an onSend hook in linkforty/cloud) to scope organic install events to the right workspace, fixing the multi-tenant data leak from the post-#75 regression where organic installs couldn't be scoped to any org. Without this schema entry, Zod would strip the field from the parsed body before Cloud's hook could read it. The token itself is a public Stripe-style publishable key shipped in SDK app bundles. It only identifies which org owns the install — it cannot authenticate API actions or expose private data. Companion to LinkForty/cloud#76 (filed alongside).
1 parent 16a0470 commit 1e68a0b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/routes/sdk.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export async function sdkRoutes(fastify: FastifyInstance) {
5252
platformVersion: z.string().optional(),
5353
deviceId: z.string().optional(),
5454
attributionWindowHours: z.number().optional(),
55+
// Public app token shipped in SDK app bundles to scope organic
56+
// installs to the right org in multi-tenant deployments. Used by
57+
// Cloud's onSend hook (see cloud-event-hook.ts). Self-hosted
58+
// single-tenant deployments simply ignore it.
59+
appToken: z.string().optional(),
5560
});
5661

5762
const body = schema.parse(request.body);

0 commit comments

Comments
 (0)