-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any plan to upgrade golang-jwt to v4? #2222
Comments
No at the moment. In Upgrading JWT to If you really want import (
"github.com/golang-jwt/jwt/v4"
)
...
...
...
signingKey := []byte("secret")
config := middleware.JWTConfig{
TokenLookup: "query:token",
ParseTokenFunc: func(auth string, c echo.Context) (interface{}, error) {
keyFunc := func(t *jwt.Token) (interface{}, error) {
if t.Method.Alg() != "HS256" {
return nil, fmt.Errorf("unexpected jwt signing method=%v", t.Header["alg"])
}
return signingKey, nil
}
// claims are of type `jwt.MapClaims` when token is created with `jwt.Parse`
token, err := jwt.Parse(auth, keyFunc)
if err != nil {
return nil, err
}
if !token.Valid {
return nil, errors.New("invalid token")
}
return token, nil
},
}
e.Use(middleware.JWTWithConfig(config)) |
@aldas that explanation makes good sense and I really appreciate your example! Close the issue. |
As per the title, is there any plan to upgrade the jwt middleware to use
github.com/golang-jwt/jwt/v4
?The text was updated successfully, but these errors were encountered: