diff --git a/goctl_template/api/context.tpl b/goctl_template/api/context.tpl index cbf433a3..cc14dc4f 100644 --- a/goctl_template/api/context.tpl +++ b/goctl_template/api/context.tpl @@ -43,7 +43,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } // 返回用于验证签名的密钥 - return svcCtx.Config.Auth.AccessSecret, nil + return []byte(svcCtx.Config.Auth.AccessSecret), nil }) if err != nil { return nil, errors.New(fmt.Sprint("Error parsing token:", err)) diff --git a/server/home-user-auth/internal/svc/servicecontext.go b/server/home-user-auth/internal/svc/servicecontext.go index f96f50c8..d324dc9c 100644 --- a/server/home-user-auth/internal/svc/servicecontext.go +++ b/server/home-user-auth/internal/svc/servicecontext.go @@ -41,7 +41,7 @@ func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, err return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } // 返回用于验证签名的密钥 - return svcCtx.Config.Auth.AccessSecret, nil + return []byte(svcCtx.Config.Auth.AccessSecret), nil }) if err != nil { return nil, errors.New(fmt.Sprint("Error parsing token:", err))