мой код:
func ValidateToken(w http.ResponseWriter, r *http.Request) {
token, err := request.ParseFromRequestWithClaims(r, request.OAuth2Extractor, &models.Claim{}, func(token *jwt.Token) (interface{}, error) {
return publicKey, nil
})
if err != nil {
fmt.Fprintln(w, "Invalid Token")
return
}
if token.Valid {
w.WriteHeader(http.StatusAccepted)
fmt.Fprintln(w, "welcome to the system")
} else {
w.WriteHeader(http.StatusUnauthorized)
fmt.Fprintln(w, "your token is not valid")
}
}
У меня проблема:
cannot use func literal (type func(*"github.com/tokens/vendor/github.com/dgrijalva/jwt-go".Token) (interface {}, error)) as type "github.com/dgrijalva/jwt-go".Keyfunc in argument to request.ParseFromRequestWithClaims