JWT 解码
解码 JSON Web Token 的头部和载荷,以 UTC 和本地时区查看标准声明,并用密钥验证 HS256、HS384 或 HS512 签名。
完全在浏览器中运行 — 粘贴的内容不会被上传。
HS256、HS384 和 HS512 在浏览器中用 Web Crypto 校验,密钥不会离开页面。RS256、ES256 等非对称令牌由签发者的私钥签名,必须在服务器上用其公开 JWKS 校验 —— 共享密钥无法验证,只有完成该检查后令牌才可信。
{
"alg": "HS256",
"typ": "JWT"
}{
"sub": "user_8f42d1",
"name": "Ryu",
"iss": "https://auth.ryuslog.com",
"aud": "ryuslog-api",
"role": "admin",
"iat": 1763251200,
"exp": 1763254800
}subuser_8f42d1Subject — the user or principal these claims describe.nameRyuName — human readable display name of the subject.isshttps://auth.ryuslog.comIssuer — the authority that created and signed the token.audryuslog-apiAudience — the service that is allowed to accept this token.roleadminRole — custom claim used by many applications for authorization.iat176325120016 Nov 2025, 00:00:00 UTC · UTCIssued At — when the token was created.exp176325480016 Nov 2025, 01:00:00 UTC · UTCExpiration Time — the token must be rejected after this instant.
JWT 声明参考
快速参考- iss
- 签发者:创建并签署该令牌的主体。
- sub
- 主体:声明所指的对象,通常是用户 ID。
- aud
- 受众:令牌面向的 API 或服务,接受前必须校验。
- exp
- 过期时间,以 NumericDate 秒表示;超过该时刻必须拒绝令牌。
- nbf
- 生效时间:在该时刻之前不得接受令牌。
- iat / jti
- iat 是签发时间的 NumericDate 秒数,jti 是用于吊销列表的唯一令牌 ID。
Node.js 相关语法指南
全部 Node.js 指南Node.js JWT invalid signature: JWKS Rotation and Clock Skew
One message covers three bugs: the wrong key type for RS256 or ES256, a JWKS cache that never refreshes after a kid rotation, and a clock that drifted.
Node.jsERR_REQUIRE_ESM and __dirname Is Not Defined in ESM Projects
require of an ESM-only package has nothing to load, and ESM creates none of the CommonJS wrapper globals. Dynamic import, createRequire, and the path replacements.
Node.jsNode.js fetch ETIMEDOUT and SELF_SIGNED_CERT_IN_CHAIN Debugging
fetch failed hides everything in error.cause. Read the aggregate, trust the private CA the way curl does, route the proxy, and set the connect timeout undici does not.
Node.jsNode.js JavaScript heap out of memory: Snapshots and Real Leaks
Distinguish needs more from leaks before raising the flag: external memory and heap tell different stories, and a heap ceiling at three quarters of the container limit keeps V8 able to report.