Skip to content

Commit

Permalink
unauthorized when you have no cookies (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye authored Feb 17, 2024
1 parent a4e2e62 commit ca9d0b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/src/middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func (m *MiddlewareService) Authorize(requiredPermissions ...auth.Permission) fu
return c.Next()
}

if c.Cookies("access_token") == "" || c.Cookies("refresh_token") == "" {
return errors.Unauthorized.FiberError(c)
}

role, err := auth.GetRoleFromToken(c.Cookies("access_token"), m.AuthSettings.AccessKey)
if err != nil {
return errors.FailedToParseAccessToken.FiberError(c)
Expand Down

0 comments on commit ca9d0b4

Please sign in to comment.