diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index c6b4ff04dec9d..28db96e5b4969 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -213,10 +213,13 @@ func reqExploreSignIn() func(ctx *context.APIContext) { } } -func reqBasicAuth() func(ctx *context.APIContext) { +func reqBasicOrRevProxyAuth() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { + if ctx.IsSigned && setting.Service.EnableReverseProxyAuth && ctx.Data["AuthedMethod"].(string) == new(auth.ReverseProxy).Name() { + return + } if !ctx.Context.IsBasicAuth { - ctx.Error(http.StatusUnauthorized, "reqBasicAuth", "basic auth required") + ctx.Error(http.StatusUnauthorized, "reqBasicOrRevProxyAuth", "auth required") return } ctx.CheckForOTP() @@ -626,7 +629,7 @@ func Routes() *web.Route { m.Combo("").Get(user.ListAccessTokens). Post(bind(api.CreateAccessTokenOption{}), user.CreateAccessToken) m.Combo("/{id}").Delete(user.DeleteAccessToken) - }, reqBasicAuth()) + }, reqBasicOrRevProxyAuth()) }) })