Skip to content

Commit 11ac3be

Browse files
authored
fix: redirect to login on gitauth invalid session (#7416)
1 parent 9908c84 commit 11ac3be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

coderd/coderd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ func New(options *Options) *API {
449449
r.Route(fmt.Sprintf("/%s", gitAuthConfig.ID), func(r chi.Router) {
450450
r.Use(
451451
httpmw.ExtractOAuth2(gitAuthConfig, options.HTTPClient, nil),
452-
apiKeyMiddleware,
452+
apiKeyMiddlewareRedirect,
453453
)
454454
r.Get("/callback", api.gitAuthCallback(gitAuthConfig))
455455
})

coderd/workspaceagents_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ func TestWorkspaceAgentsGitAuth(t *testing.T) {
876876
}},
877877
})
878878
resp := coderdtest.RequestGitAuthCallback(t, "github", client)
879-
require.Equal(t, http.StatusUnauthorized, resp.StatusCode)
879+
require.Equal(t, http.StatusSeeOther, resp.StatusCode)
880880
})
881881
t.Run("AuthorizedCallback", func(t *testing.T) {
882882
t.Parallel()

0 commit comments

Comments
 (0)