Skip to content

Let TikTok Shop connectors use a server-level app and App Store installs - #1535

Merged
helpcodeai merged 2 commits into
mainfrom
feat/tiktok-shop-platform-app
Nov 5, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
feat/tiktok-shop-platform-app

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Closes #1533.

Why

Most TikTok Shop sellers cannot create their own Partner Center app: TikTok gives seller-developer access only to sellers with an account manager. With this change a server can register one public TikTok Shop app and let every seller authorize it. TikTok's app review installs the app from its App Store, and that install reaches our Redirect URL without a state we issued. Today the callback refuses it.

What changes

  • Server app. New optional server variables: TIKTOK_SHOP_PLATFORM_APP_KEY, TIKTOK_SHOP_PLATFORM_APP_SECRET and TIKTOK_SHOP_PLATFORM_SERVICE_ID. All three must be set.
    • A TikTok Shop connector whose own App key is empty signs, authorizes and renews with the server app. This covers the REST engine, the token refresh, the shop lookup, and authorize and complete.
    • A connector with its own App key behaves as before.
    • The server secret only lives in in-memory copies: it is never stored on a connector, returned by the API or logged.
  • Setup.
    • GET /api/tiktok-shop/platform tells the dashboard whether the server app exists.
    • When it exists, the setup page hides App key, App secret and Service ID behind "Use your own TikTok Shop app".
    • Without a server app, setup still asks for the three variables (needs_input), and authorize returns the existing message.
  • App Store install.
    • The callback accepts a request with a code and no state when the server app exists and app_key matches it. It keeps the code in a single-use encrypted record that lasts 30 minutes, and it is throttled.
    • It redirects to the dashboard, where the seller signs in or signs up.
    • POST /api/tiktok-shop/install reuses the workspace's waiting TikTok Shop connector, or installs the catalog adapter. It checks plan limits and the caller's role, and uses the default MCP server. It then exchanges the code.
    • A present but unknown state still says "expired".
  • Docs: adapter text, .env.example, docs/deployment.md, docs/tool-definition.md. Both compose files pass the three variables through.

Cloud and self-hosted

Both behave the same, and nothing depends on isCloud(). With the variables unset, a server behaves exactly as before.

Tests (worktree root and packages; all run on this branch)

  • Root:
    • node scripts/validate-adapters.mjs --warn: exit 0; the warnings are the same as on main, none for tiktok-shop.
    • node scripts/regenerate-catalog.mjs: no change to catalog.ts.
    • node scripts/adapter-count.mjs --check: OK.
  • packages/backend:
    • npm run lint: 0 errors; the warnings are all in files this PR does not touch.
    • npx tsc --noEmit -p tsconfig.json: clean.
    • npx jest --maxWorkers=4 src/adapters src/connectors src/common/openapi.spec.ts: 805 suites passed, 3 skipped (live).
  • packages/frontend:
    • npm run lint: 0 errors.
    • npx tsc --noEmit -p tsconfig.json: clean.
    • Playwright connector-oauth-complete.spec.ts: 6/6, including 2 new install tests.
    • The setup-page specs: 27/27.

Not verified live

I could not verify two points against a real install: that App Store installs send app_key, code and shop_region with no state, and that a public app accepts the service_id authorization link. Both will be checked during TikTok's app review.

…lls (#1533)

Most sellers cannot create their own TikTok Shop Partner Center app, so a
server can now register one public app through TIKTOK_SHOP_PLATFORM_APP_KEY,
TIKTOK_SHOP_PLATFORM_APP_SECRET and TIKTOK_SHOP_PLATFORM_SERVICE_ID.

- A TikTok Shop connector whose App key is empty signs, authorizes and
  renews with the server app; the app is filled in memory only and never
  stored on the connector. A connector with its own App key is unchanged.
- The adapter's app variables are optional; on a server without the app,
  the setup check still reports them as missing.
- The setup page hides the app fields when the server app is available,
  with an option to use an own app (GET /api/tiktok-shop/platform).
- A callback with a code and no state (TikTok Shop App Store install) is
  kept as a single-use install record; POST /api/tiktok-shop/install adds
  or reuses a connector after the seller signs in or signs up, and
  exchanges the code with the server app.
- Same behaviour on Cloud and self-hosted; documented in .env.example,
  the compose files, docs/deployment.md and docs/tool-definition.md.
@helpcodeai
helpcodeai requested a review from D3nisty as a code owner November 5, 2026 13:12
@helpcodeai
helpcodeai enabled auto-merge (squash) November 5, 2026 13:53
@helpcodeai
helpcodeai merged commit 44a2e31 into main Nov 5, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the feat/tiktok-shop-platform-app branch November 5, 2026 14:25
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 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.

TikTok Shop: server-level public app and App Store installs

1 participant