This commit is contained in:
2026-07-18 10:52:32 +08:00
parent 2dcafae465
commit b5ef58f434
61 changed files with 1274 additions and 2142 deletions

View File

@@ -43,16 +43,6 @@ func ParseToken(tokenString, secret string) (*JWTClaims, error) {
}
if claims, ok := token.Claims.(*JWTClaims); ok && token.Valid {
jsonBytes, err := json.MarshalIndent(claims, "", " ") // MarshalIndent 用于格式化输出,更易读
if err != nil {
// 记录序列化错误,但不一定中断业务逻辑,视需求而定
log.Printf("Failed to marshal claims to JSON: %v", err)
} else {
// 2. 在控制台输出 JSON 字符串
fmt.Println("=== Decoded JWT Claims ===")
fmt.Println(string(jsonBytes))
fmt.Println("==========================")
}
return claims, nil
}