In jwt.go:117 a custom error exists for this purpose to return 401
// ErrJWTMissing denotes an error raised when JWT token value could not be extracted from request
var ErrJWTMissing = echo.NewHTTPError(http.StatusUnauthorized, "missing or malformed jwt")
But when trying to extract the jwt instead of returning ErrJWTMissing another new error is created and returned with status 400.
jwt.go.258
if lastTokenErr == nil {
return echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt").SetInternal(err)
}
I think the intention is to do the following instead
if lastTokenErr == nil {
return ErrJWTMissing.SetInternal(err)
}
... not sure about the .SetInternal(err) though
This behavior seems to be against the definition of 401. Or is there a reason for that?