Skip to content

fix(shopify): accept the OAuth callback on the MCP's own origin - #529

Merged
guitavano merged 1 commit into
mainfrom
guitavano/shopify-oauth-self-origin-callback
Jul 28, 2026
Merged

fix(shopify): accept the OAuth callback on the MCP's own origin#529
guitavano merged 1 commit into
mainfrom
guitavano/shopify-oauth-self-origin-callback

Conversation

@guitavano

@guitavano guitavano commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #528. The SELF_URL/MESH_URL fix merged, but a third fix was left out and the flow still errors with "Invalid or missing callback URL" in prod.

Cause

The runtime mounts its /oauth/callback on this MCP's own origin, so the callback_url handed to authorizationUrl is:

https://sites-shopify.deco.site/oauth/callback?state=…

i.e. on sites-shopify.deco.site, not decocms.com. The callback allowlist from #528 only accepted decocms.com (+ loopback + MESH_URL), so it rejected the real callback.

Fix

Accept the SELF_URL origin as the primary allowed callback origin (that's where the runtime mounts /oauth/callback), keeping decocms.com, loopback and the optional MESH_URL override.

Tests

bun test — oauth suite 17 pass, incl. a new case: a callback on the MCP's own origin is accepted. tsc clean.

🤖 Generated with Claude Code


Summary by cubic

Accept OAuth callbacks on this MCP’s own origin (SELF_URL) so the Shopify OAuth flow no longer fails with “Invalid or missing callback URL.” The allowlist still includes decocms.com, loopback, and optional MESH_URL.

  • Bug Fixes
    • Updated isAllowedCallback to trust the SELF_URL origin and wired env.selfUrl through connect/callback handlers.
    • Added a test to accept self-origin callbacks; OAuth test suite passes.

Written for commit 7b61ef4. Summary will update on new commits.

Review in cubic

The runtime mounts its /oauth/callback on this MCP's own server, so the
callback_url handed to authorizationUrl is on SELF_URL's origin
(sites-shopify.deco.site), not decocms.com — the decocms-only allowlist
rejected it with "Invalid or missing callback URL". Allow the SELF_URL origin
(the primary case), keeping decocms.com, loopback and the MESH_URL override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@guitavano
guitavano merged commit 8ffdcf6 into main Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant