You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am following the example in the README, and am receiving the following error:
Cannot use 'keyFunc' (type func(ctx context.Context) (interface{}, error)) as the type func(context.Context) (interface{}, error)
The only thing I can surmise is that I am using beego, but from what I could tell - it is the same context.
keyFunc := func(ctx context.Context) (interface{}, error) {
// Our token must be signed using this data.
return []byte("secret"), nil
}
// Set up the validator.
jwtValidator, err := validator.New(
keyFunc, // error occurs here
validator.HS256,
"https://<issuer-url>/",
[]string{"<audience>"},
)
if err != nil {
log.Fatalf("failed to set up the validator: %v", err)
}
middleware := jwtmiddleware.New(jwtValidator.ValidateToken)
Reproduction
Using latest SDK, used github.com/form3tech-oss/jwt-go instead of the prior.
When copying the keyFunc declaration along with the validator creator, it throws that error.
Go JWT Middleware version
2 .2.1
Go version
1.22.5 darwin/arm64
The text was updated successfully, but these errors were encountered:
Checklist
Description
I am following the example in the README, and am receiving the following error:
Cannot use 'keyFunc' (type func(ctx context.Context) (interface{}, error)) as the type func(context.Context) (interface{}, error)
The only thing I can surmise is that I am using beego, but from what I could tell - it is the same context.
Reproduction
Using latest SDK, used github.com/form3tech-oss/jwt-go instead of the prior.
When copying the keyFunc declaration along with the validator creator, it throws that error.
Go JWT Middleware version
2 .2.1
Go version
1.22.5 darwin/arm64
The text was updated successfully, but these errors were encountered: