Skip to content

Commit 8a233d5

Browse files
bugfix - calling endpoints without token
1 parent bb810db commit 8a233d5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

middlewares/auth.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func Authenticate(c *fiber.Ctx) error {
9797
path = strings.Split(path, "?")[0]
9898
if isAuthNeeded(path) {
9999
headers := c.GetReqHeaders()
100+
if len(headers["Authorization"]) == 0 {
101+
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
102+
"message": "Unauthorized",
103+
})
104+
}
100105
tokenString, err := extractToken(headers["Authorization"][0])
101106
if err != nil || tokenString == "" {
102107
tokenString = c.Query("authorization")

0 commit comments

Comments
 (0)