fix(shopify): accept the OAuth callback on the MCP's own origin - #529
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #528. The
SELF_URL/MESH_URLfix 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/callbackon this MCP's own origin, so thecallback_urlhanded toauthorizationUrlis:i.e. on
sites-shopify.deco.site, notdecocms.com. The callback allowlist from #528 only accepteddecocms.com(+ loopback +MESH_URL), so it rejected the real callback.Fix
Accept the
SELF_URLorigin as the primary allowed callback origin (that's where the runtime mounts/oauth/callback), keepingdecocms.com, loopback and the optionalMESH_URLoverride.Tests
bun test— oauth suite 17 pass, incl. a new case: a callback on the MCP's own origin is accepted.tscclean.🤖 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 includesdecocms.com, loopback, and optionalMESH_URL.isAllowedCallbackto trust theSELF_URLorigin and wiredenv.selfUrlthrough connect/callback handlers.Written for commit 7b61ef4. Summary will update on new commits.