diff --git a/jwt.go b/jwt.go index 2a88609..39f0160 100644 --- a/jwt.go +++ b/jwt.go @@ -38,7 +38,7 @@ func (j *ownJwt) Generate(signMethod jwt.SigningMethod, secret string, claims jw } else { token = jwt.NewWithClaims(signMethod, claims) } - return token.SignedString(secret) + return token.SignedString([]byte(secret)) } // Validate 验证token @@ -53,7 +53,7 @@ func (j *ownJwt) Validate(inputToken string, secret string) (jwt.Claims, error) ) if token, err = jwt.Parse(inputToken, func(tokenInfo *jwt.Token) (interface{}, error) { - return secret, nil + return []byte(secret), nil }); nil != err { return nil, errors.New("token parse fail : " + err.Error()) }