Examples
This section provides practical examples of using the JWT Parser tool with different types of JWT tokens.
Basic JWT Example
Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTYyNDI2MjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Parsed Header
{
"alg": "HS256",
"typ": "JWT"
}
Parsed Payload
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022,
"exp": 1516242622
}
Analysis
- Algorithm: HS256 (HMAC with SHA-256)
- Type: JWT
- Subject: 1234567890
- Name: John Doe
- Issued At: January 19, 2018, 6:30:22 PM GMT
- Expires: January 19, 2018, 7:30:22 PM GMT
Authentication Token Example
Token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwic3ViIjoiMTIzNDU2Nzg5MCIsImF1ZCI6Im15YXBwIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTYyNDI2MjIsInJvbGUiOiJhZG1pbiIsInBlcm1pc3Npb25zIjpbInJlYWQiLCJ3cml0ZSIsImRlbGV0ZSJdfQ.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgH58ERTqYZyhtFJKh3ue6by8xcZMUd9J3d_VXaUeHy0yvaAffXYfTLQo6josBX6koFNo7cF8_IYfY1bCRXKgcS3mR8LS65lVmzuJmNF2UzP5k6N3k-jtd399gOmr9eWzE2LbUeqNfqpccX9xemRY9CP1JJs_76ejFk9FjCl79Z_0t1fYEE8NHmktoOgupIN_6eP59T0aH5nNtTpzV1mk_W7V3yJiqz0Nnp7dOfpW_VeaEj_1TqBj0
Parsed Header
{
"alg": "RS256",
"typ": "JWT"
}
Parsed Payload
{
"iss": "https://example.com",
"sub": "1234567890",
"aud": "myapp",
"iat": 1516239022,
"exp": 1516242622,
"role": "admin",
"permissions": ["read", "write", "delete"]
}
Analysis
- Algorithm: RS256 (RSA with SHA-256)
- Issuer: https://example.com
- Subject: 1234567890
- Audience: myapp
- Role: admin
- Permissions: read, write, delete
- Expires: 1 hour after issuance
API Access Token Example
Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjMsImVtYWlsIjoiam9obi5kb2VAZXhhbXBsZS5jb20iLCJzY29wZXMiOlsicmVhZCIsIndyaXRlIl0sImFwcF9pZCI6Im15YXBwIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTYyNDI2MjJ9.4Adcj3UFYzPUVaVF43FmMab6RlaQD8A9V8wFzzht-KQ
Parsed Header
{
"alg": "HS256",
"typ": "JWT"
}
Parsed Payload
{
"user_id": 123,
"email": "john.doe@example.com",
"scopes": ["read", "write"],
"app_id": "myapp",
"iat": 1516239022,
"exp": 1516242622
}
Analysis
- User ID: 123
- Email: john.doe@example.com
- Scopes: read, write
- App ID: myapp
- Expires: 1 hour after issuance
Refresh Token Example
Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjMsInRva2VuX3R5cGUiOiJyZWZyZXNoIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTY5NDM4MjJ9.7d_kzR8y0B1M2Z3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6
Parsed Header
{
"alg": "HS256",
"typ": "JWT"
}
Parsed Payload
{
"user_id": 123,
"token_type": "refresh",
"iat": 1516239022,
"exp": 1516943822
}
Analysis
- User ID: 123
- Token Type: refresh
- Expires: 7 days after issuance (longer than access tokens)
Microservice Communication Token
Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXJ2aWNlX2lkIjoiYXV0aC1zZXJ2aWNlIiwic2VydmljZV9yb2xlIjoiYXV0aGVudGljYXRvciIsInRhcmdldF9zZXJ2aWNlIjoiY29yZS1zZXJ2aWNlIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE1MTYyNDI2MjJ9.8f_kzR8y0B1M2Z3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6
Parsed Header
{
"alg": "HS256",
"typ": "JWT"
}
Parsed Payload
{
"service_id": "auth-service",
"service_role": "authenticator",
"target_service": "core-service",
"iat": 1516239022,
"exp": 1516242622
}
Analysis
- Service ID: auth-service
- Service Role: authenticator
- Target Service: core-service
- Expires: 1 hour after issuance
Mobile App Token Example
Token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMjMsImRldmljZV9pZCI6ImRldmljZTEyMyIsImFwcF92ZXJzaW9uIjoiMS4wLjAiLCJwbGF0Zm9ybSI6ImlPUyIsImlhdCI6MTUxNjIzOTAyMiwiZXhwIjoxNTE2MjQyNjIyfQ.9g_kzR8y0B1M2Z3N4O5P6Q7R8S9T0U1V2W3X4Y5Z6
Parsed Header
{
"alg": "HS256",
"typ": "JWT"
}
Parsed Payload
{
"user_id": 123,
"device_id": "device123",
"app_version": "1.0.0",
"platform": "iOS",
"iat": 1516239022,
"exp": 1516242622
}
Analysis
- User ID: 123
- Device ID: device123
- App Version: 1.0.0
- Platform: iOS
- Expires: 1 hour after issuance
Error Examples
Invalid Format
invalid.jwt.token
Error: "Invalid JWT format. JWT should have 3 parts separated by dots."
Malformed JSON
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.invalid-json.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Error: "Failed to parse JWT token"
Invalid Base64
invalid-base64.yyyyy.zzzzz
Error: "Failed to parse JWT token"
Usage Scenarios
Development Debugging
- API Testing: Parse tokens from API responses
- Authentication Flow: Debug authentication issues
- Token Validation: Verify token structure
- Claims Analysis: Check user permissions
Security Analysis
- Token Inspection: Examine token contents
- Expiration Monitoring: Check token lifetime
- Algorithm Verification: Confirm signing algorithm
- Claims Review: Analyze user data
Integration Testing
- Third-party APIs: Parse external service tokens
- Microservices: Analyze inter-service tokens
- Mobile Apps: Debug mobile authentication
- Web Applications: Test web authentication
Best Practices
Token Selection
- Use Test Tokens: Always use test or development tokens
- Avoid Production: Never use production tokens
- Sensitive Data: Avoid tokens with sensitive information
- Expired Tokens: Use expired tokens for testing
Analysis Workflow
- Load Token: Paste or load the token
- Review Structure: Check header and payload structure
- Analyze Claims: Review all claims and their values
- Check Expiration: Verify expiration time
- Copy Results: Save results for documentation
Documentation
- Include Examples: Use parsed results in documentation
- Share Safely: Only share test token examples
- Update Regularly: Keep examples current
- Version Control: Track changes to examples