ai icon indicating copy to clipboard operation
ai copied to clipboard

remote-mcp-server: OAuth flow incorrectly redirects to localhost instead of the production URL

Open arre-ankit opened this issue 5 months ago • 1 comments

Issue Description

After deploying the remote-mcp-server to Cloudflare, the OAuth flow incorrectly redirects to localhost instead of the production URL. The OAuth callback returns to http://localhost:61576/oauth/callback instead of using the deployed Cloudflare domain.

Relevant Code

// The user must be successfully logged in and have approved the scopes, so we
    // can complete the authorization request
    const { redirectTo } = await c.env.OAUTH_PROVIDER.completeAuthorization({
        request: oauthReqInfo,
        userId: email,
        metadata: {
            label: "Test User",
        },
        scope: oauthReqInfo.scope,
        props: {
            userEmail: email,
        },
    });

Expected Behavior

The OAuth callback should redirect to the deployed Cloudflare domain URL instead of localhost.

arre-ankit avatar May 18 '25 16:05 arre-ankit