🐛 Fix websocket cannot pass auth

This commit is contained in:
2024-03-30 21:59:05 +08:00
parent 729409618b
commit eacfd7296e
2 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,9 @@ func authMiddleware(c *fiber.Ctx) error {
tk := strings.Replace(header, "Bearer", "", 1)
token = strings.TrimSpace(tk)
}
if query := c.Query("tk"); len(query) > 0 {
token = strings.TrimSpace(query)
}
c.Locals("token", token)