diff --git a/middleware/auth.go b/middleware/auth.go index 3cf31a9c..0d31a8e2 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -51,6 +51,10 @@ func AuthMiddleware() gin.HandlerFunc { return func(c *gin.Context) { k := strings.TrimSpace(c.GetHeader("Authorization")) if k != "" { + if strings.HasPrefix(k, "Bearer ") { + k, _ = strings.CutPrefix(k, "Bearer ") + } + if strings.HasPrefix(k, "sk-") { // api agent if ProcessKey(c, k) { return