介绍
JSON Web Token (JWT) 广泛用于 Web 应用程序中的身份验证和信息交换。我们的 JWT 解码器让您检查任何 JWT 的内容,查看头部和负载,并验证签名。调试您的令牌并了解它们包含的数据。
该工具完全在您的浏览器中运行,无需服务器端处理。您的数据永远不会离开您的设备,确保完全的隐私和安全。无需注册,打开即用。
主要功能
- 1 即时 JWT 解码和显示
- 2 分别查看头部、负载和签名
- 3 颜色编码的 JSON 语法高亮
- 4 验证 JWT 签名和结构
- 5 将解码的 JSON 复制到剪贴板
- 6 支持紧凑和美化 JSON
- 7 检测格式错误的令牌
- 8 解释每个 JWT 组件
- 9 适用于访问令牌、ID 令牌和自定义 JWT
- 10 隐私保护:所有解码在浏览器中进行
- 11 不存储或传输令牌
- 12 移动友好的响应式设计
使用方法
- 1 在输入字段中粘贴您的 JWT 令牌
- 2 即时查看解码的头部、负载和签名
- 3 检查负载中的声明:iss、exp、sub 等
- 4 验证令牌签名和结构
- 5 将解码的 JSON 或单个声明复制到剪贴板
为什么选择此工具
即时解码
粘贴任何 JWT 并立即查看其内容。无需了解 base64 编码。
颜色编码
解码的 JSON 带有语法高亮以提高可读性。易于扫描特定声明。
组件分离
头部、负载和签名分别显示。清晰了解每个部分的作用。
错误检测
格式错误的令牌会标记并提供有用的错误消息。更快地调试身份验证问题。
解释提示
将鼠标悬停在任何声明(exp、nbf、aud)上以查看其含义。在调试时学习 JWT。
完全隐私
JWT 可能包含敏感用户数据。所有解码都保留在您的浏览器中 - 令牌永远不会发送到任何地方。
常见使用场景
调试 Web 应用程序中的身份验证问题
检查来自 OAuth 提供商的访问令牌和 ID 令牌
在代码中接受令牌声明之前验证它们
了解您的 JWT 包含的数据
测试令牌过期和续订逻辑
解码 API 令牌以调试请求
学习 JWT 结构和标准声明
验证令牌签名以进行安全测试
Understanding JWT Structure
What is a JWT?
A JSON Web Token (JWT) is a compact, URL-safe way to transmit claims between two parties. It's commonly used for authentication and authorization.
JWT Has Three Parts
- Header: Contains token type and signing algorithm
- Payload: Contains the claims (data)
- Signature: Verifies the token wasn't tampered with
Common Claims
iss: Issuer—who created the tokensub: Subject—who the token is aboutaud: Audience—who the token is forexp: Expiration timeiat: Issued at time
JWT Common Issues
Error: "Invalid signature"
Cause: The signature doesn't match what it should be.
Possible reasons:
- Using wrong secret/public key
- Token was tampered with
- Mismatched algorithm (HS256 vs RS256)
Error: "Token expired"
Cause: The exp claim is in the past.
Solution: Get a new token from the authentication server.
Error: "Audience invalid"
Cause: The aud claim doesn't match your application.
Solution: Check that you're using the correct audience value.
JWT Security Best Practices
Do's
- Always verify signatures
- Check expiration (
expclaim) - Use HTTPS to transmit tokens
- Store tokens securely (httpOnly cookies)
- Use RS256 (asymmetric) over HS256 (symmetric)
Don'ts
- Don't store tokens in localStorage (XSS vulnerable)
- Don't put sensitive data in JWT (it's base64 encoded, not encrypted)
- Don't trust tokens without signature verification
Token Storage
- Best: httpOnly cookies (CSRF protected)
- Good: Memory (lost on page refresh)
- Avoid: localStorage, sessionStorage