From 0ef5a75912a714f4a61205d91ffed82f7e5dd6b8 Mon Sep 17 00:00:00 2001 From: Atharva Patil <53966412+atharva1051@users.noreply.github.com> Date: Thu, 19 Feb 2026 12:15:35 +0000 Subject: [PATCH 1/4] chore: gh-host as oauth auth server --- pkg/http/server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/http/server.go b/pkg/http/server.go index 7397e54a8..a7dd0b2c9 100644 --- a/pkg/http/server.go +++ b/pkg/http/server.go @@ -126,6 +126,7 @@ func RunHTTPServer(cfg ServerConfig) error { oauthCfg := &oauth.Config{ BaseURL: cfg.BaseURL, ResourcePath: cfg.ResourcePath, + AuthorizationServer: cfg.Host + "login/oauth", } serverOptions := []HandlerOption{} From ee63c5146eef55891b070fe79850cda2ef2fd701 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 12:25:34 +0000 Subject: [PATCH 2/4] Initial plan From 3faac62ccff69ec9d6689d04316779a101324d41 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 12:29:29 +0000 Subject: [PATCH 3/4] fix: only set AuthorizationServer when gh-host is explicitly configured When gh-host is not set (github.com users), the AuthorizationServer field was being set to just "login/oauth" (empty host + path), breaking OAuth metadata. Now it only overrides the default when gh-host is provided (GHES users), allowing github.com users to get the correct default of "https://github.com/login/oauth". Co-authored-by: atharva1051 <53966412+atharva1051@users.noreply.github.com> --- pkg/http/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/http/server.go b/pkg/http/server.go index a7dd0b2c9..25a7ae1d4 100644 --- a/pkg/http/server.go +++ b/pkg/http/server.go @@ -126,7 +126,9 @@ func RunHTTPServer(cfg ServerConfig) error { oauthCfg := &oauth.Config{ BaseURL: cfg.BaseURL, ResourcePath: cfg.ResourcePath, - AuthorizationServer: cfg.Host + "login/oauth", + } + if cfg.Host != "" { + oauthCfg.AuthorizationServer = cfg.Host + "login/oauth" } serverOptions := []HandlerOption{} From f5b8ecc600939bb72b8a689011e5b1aa8225a59f Mon Sep 17 00:00:00 2001 From: Atharva Patil <53966412+atharva1051@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:53:08 +0000 Subject: [PATCH 4/4] fix: joining url using net/url --- pkg/http/server.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/http/server.go b/pkg/http/server.go index 25a7ae1d4..a35ce7a60 100644 --- a/pkg/http/server.go +++ b/pkg/http/server.go @@ -6,6 +6,7 @@ import ( "io" "log/slog" "net/http" + "net/url" "os" "os/signal" "slices" @@ -128,7 +129,12 @@ func RunHTTPServer(cfg ServerConfig) error { ResourcePath: cfg.ResourcePath, } if cfg.Host != "" { - oauthCfg.AuthorizationServer = cfg.Host + "login/oauth" + u := &url.URL{ + Scheme: "https", + Host: cfg.Host, + Path: "/login/oauth", + } + oauthCfg.AuthorizationServer = u.String() } serverOptions := []HandlerOption{}