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 — [FEATURE]: make OAUTH_CALLBACK_HOST configurable · Issue #33966 · anomalyco/opencode

[FEATURE]: make OAUTH_CALLBACK_HOST configurable #33966

New issue
Copy link
New issue
Copy link
Closed
Closed
[FEATURE]: make OAUTH_CALLBACK_HOST configurable#33966
Copy link
Assignees
rekram1-node

Description

@ryepup
ryepup
opened on Jun 25, 2026
Issue body actions

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

#30022 recently changed the oauth server to bind to 127.0.0.1 only.

I use opencode inside a container, and was using docker run -p 19876 to get the browser on my host talking to opencode via http://127.0.0.1:19876.

I would like a new envvar or config option to customize OAUTH_CALLBACK_HOST.

workaround

Use a docker entrypoint with socat to route traffic

#!/usr/bin/env bash
socat TCP-LISTEN:19877,fork,bind=0.0.0.0 TCP:127.0.0.1:19876 &
opencode "$@"

When I need to authenticate, I run docker run -p 19876:19877 --entrypoint=..., with routes the traffic correctly:

flowchart
    subgraph host
        browser
        docker
        subgraph container
            socat
            opencode
        end
    end
    browser -->|127.0.0.1:19876| docker
    docker -->|0.0.0.0:19877| socat
    socat -->|127.0.0.1:19876| opencode
Loading

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jun 25, 2026
  2. github-actions commented on Jun 25, 2026

    @github-actions
    github-actionsBot
    on Jun 25, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • opencode web behind a reverse proxy: OAuth callbacks should use the external URL, not localhost:1455 #24455: Same root problem — OAuth callback host/URL is not configurable, making OAuth flows fail in container/reverse-proxy deployments where the listener binds only to 127.0.0.1.
  3. ryepup commented on Jun 25, 2026

    @ryepup
    ryepup
    on Jun 25, 2026
    Author
    More actions

    This is a different oauth flow than #24455, I think it's a separate issue.

  4. wp07e commented on Jul 5, 2026

    @wp07e
    wp07e
    on Jul 5, 2026
    More actions

    Thank you! Been struggling with this the entire day. I'll use your work around for now.

  5. magnuslarsen commented on Jul 6, 2026

    @magnuslarsen
    magnuslarsen
    on Jul 6, 2026
    More actions

    I too would like to see this fixed. I have a remote server where I run OpenCode, and authenticate via my laptop. This broke with the hardcoded 127.0.0.1 host

  6. dannykopping commented on Aug 12, 2026

    @dannykopping
    dannykopping
    on Aug 12, 2026
    More actions

    It's becoming more and more essential to run AI agents inside of sandboxes, and listening only on localhost prevents that from being done easily, since the locally-bound port can't be addressed from the outside during the OAuth callback.

  7. ryepup commented on Aug 14, 2026

    @ryepup
    ryepup
    on Aug 14, 2026
    Author
    More actions

    I can think of two ways to solve this:

    • quick & dirty: const OAUTH_CALLBACK_HOST = process.env.OPENCODE_OAUTH_CALLBACK_HOST || "127.0.0.1"; - no other config works this way
    • slow & clean: expand the config schema to allow setting it there, requires more design and consensus, and some more plumbing code. to get the current config into packages/opencode/src/mcp/oauth-callback.ts. In this case my best guess is an optional "host" arg to McpOAuthCallback.ensureRunning, and expand the Oauth schema to have an optional callbackHost next to callbackPort. We'd want to add both callback* options to https://opencode.ai/docs/mcp-servers#oauth-options.
  8. tstraley commented on Oct 14, 2026

    @tstraley
    tstraley
    on Oct 14, 2026
    More actions

    This type of issue could also be solved with headless (paste-code) oauth solution, as brought up in #54495

  9. opencodejr commented on Oct 29, 2026

    @opencodejr
    opencodejrBot
    on Oct 29, 2026
    Contributor
    More actions

    Thanks for the request and for writing up the socat workaround, @ryepup!

    To restate it: you'd like a config option or environment variable to set the host the MCP OAuth callback listener binds to. When OpenCode runs in a container, sandbox or on a remote host, the browser could then reach the callback through a published port. Since #30022 the listener is bound to 127.0.0.1 only. The current v2 code (packages/core/src/mcp/oauth.ts) also hardcodes 127.0.0.1, and only callback_port and redirect_uri can be configured. Maintainers will consider it.

    Related issues and PRs:

    • feat(mcp): support explicit OAuth callback host binding #9078: an earlier PR that added an oauth.callbackHost option for this. It was never merged.
    • WSL2/devcontainer: MCP OAuth callback unreachable from host browser (Sentry) #9081: the matching v1 report (WSL2/devcontainer callback unreachable), closed as not planned.
    • [FEATURE]: MCP OAuth paste-code fallback for headless/SSH sessions #54495 / feat(core): accept a pasted redirect URL for MCP OAuth #58370: a paste-the-redirect-URL fallback for headless or remote sessions, which would avoid the listener altogether.
    • [FEATURE]: MCP OAuth: let the engine choose and hold its loopback listener per attempt and report it #57130: a request for the engine to own and report its loopback listener for each attempt.
    • mcp: OAuth loopback callback fails with a remote OpenCode server #59869: MCP OAuth failing when the OpenCode server is remote.
    • MCP OAuth cannot use public proxy redirect URLs with a local callback listener #31014: a separate provider-facing redirect URL for proxied setups.

    Until then, your socat entrypoint (or SSH port forwarding for remote hosts) is the way to go.

  10. neriousy commented on Nov 19, 2026

    @neriousy
    neriousy
    on Nov 19, 2026
    Member
    More actions

    This should be covered by #61706, which takes a different approach than a configurable host.

    When OpenCode runs over SSH, in a container or on a remote server, the browser can't reach the local callback after you sign in, so it shows a page that doesn't load. Copy that page's URL from the address bar and paste it into the sign-in prompt:

    http://127.0.0.1:52817/callback?code=...&state=...
    

    The prompt appears in /mcps, in opencode mcp auth, and in the sign-in dialog of the desktop and web app. The pasted URL goes through the same checks as a normal browser redirect. See MCP servers → Browser on another machine in the docs.

    Closing this for now. If your setup still needs the callback to bind to a different host, let us know and we'll reopen it.

  11. neriousy
    closed this as completedon Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — 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.