GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: send `mcpName` as state if authUrl doesn't have `state` (#5681) · toastdriven/opencode@57c3cf1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src/mcp
    • index.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/mcp/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/mcp/index.ts
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,18 @@ export namespace MCP {
494494
// Extract state from authorization URL to use as callback key
495495
// If no state parameter, use mcpName as fallback
496496
const authUrl = new URL(authorizationUrl)
497-
const oauthState = authUrl.searchParams.get("state") ?? mcpName
497+
let oauthState = mcpName
498+
499+
if (authUrl.searchParams.has("state")) {
500+
oauthState = authUrl.searchParams.get("state")!
501+
} else {
502+
log.info("no state parameter in authorization URL, using mcpName as state", { mcpName })
503+
authUrl.searchParams.set("state", oauthState)
504+
}
498505

499506
// Open browser
500-
log.info("opening browser for oauth", { mcpName, url: authorizationUrl, state: oauthState })
501-
await open(authorizationUrl)
507+
log.info("opening browser for oauth", { mcpName, url: authUrl.toString(), state: oauthState })
508+
await open(authUrl.toString())
502509

503510
// Wait for callback using the OAuth state parameter (or mcpName as fallback)
504511
const code = await McpOAuthCallback.waitForCallback(oauthState)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.