Closed
Description
e := echo.New()
authGroup := e.Group("/v1")
authGroup.Use(middleware.KeyAuth(func(key string, c echo.Context) (bool, error) {
user := api.service.CheckUser(key) // checks if user with "key" exists into db
if user != nil {
api.user = user
return true, nil
}
err := fmt.Errorf("Invalid auth key: %s", key)
log.Error(err)
return false, err
}))
Expected behaviour on failed KeyAuth check – HTTP 401 Unauthorized
But Echo returns HTTP 500 Internal server error.
Do I do something wrong?
Or it is an issue, that needed improvement/fix?
Metadata
Metadata
Assignees
Labels
No labels