Skip to content

feat(sdk): accept optional appToken on /api/sdk/v1/install#24

Merged
onamfc merged 1 commit intomainfrom
feat/sdk-install-app-token
May 4, 2026
Merged

feat(sdk): accept optional appToken on /api/sdk/v1/install#24
onamfc merged 1 commit intomainfrom
feat/sdk-install-app-token

Conversation

@onamfc
Copy link
Copy Markdown
Member

@onamfc onamfc commented May 4, 2026

Adds an optional `appToken` field 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, separate PR) to scope organic install events to the right workspace. Without this schema entry, Zod would strip the field before the hook could read it from `request.body`.

What this is

The `appToken` is a public Stripe-style publishable key shipped in SDK app bundles. It:

  • Only identifies which workspace owns the install
  • Cannot authenticate API actions
  • Cannot expose private data
  • Is safe to include in mobile app bundles

What this isn't

This PR makes no semantic change to the install endpoint's behavior in core. The endpoint:

  • Still authenticates as None (unauthenticated)
  • Still computes the same fingerprint match
  • Still returns the same response

The only change is that the Zod schema now formally accepts an extra optional field.

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).
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@onamfc onamfc merged commit 1e68a0b into main May 4, 2026
12 of 13 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant