jwt_decoder
2.0.1, released 6 years ago by an unverified publisher
Decode Json Web Tokens and check expiration status without a password.
WASM-readyUnverified publisher
What it does
Decodes JSON Web Tokens (JWT) base64-encoded headers and payloads into a Map. Provides utility methods to check if a token is expired, retrieve its expiration date, check token age, and get remaining time.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to inspect JWT payload data on the client side
- You need to check token expiration or remaining time in Dart or Flutter
Skip it when
- You need to cryptographically verify or sign JWT signatures on the client
Strengths
- Lightweight with no external dependencies
- Works across all platforms including Dart-only environments
- Simple static methods for quick decoding and expiration checks
Weaknesses
- Does not verify the cryptographic signature of the token
- Throws FormatException on invalid tokens instead of returning null
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
String yourToken = "Your JWT";
Map<String, dynamic> decodedToken = JwtDecoder.decode(yourToken);
bool hasExpired = JwtDecoder.isExpired(yourToken);Alternatives
Packages that do the same job and could replace jwt_decoder.
- json_schema
Validate JSON data against JSON Schema drafts in Dart.
63Compare
Works with
Packages commonly used together with jwt_decoder: ones it builds on, ones built on it, and its own family.
- solidpodBuilt on jwt_decoderAccess and manage private data stores on Solid servers.
- nakamaBuilt on jwt_decoderDart and Flutter client for the open-source Nakama game server.
- dio_refreshBuilt on jwt_decoderDio interceptor for automatic token refresh and retry on API failures
- corbado_authBuilt on jwt_decoderFlutter SDK for passkey authentication via Corbado
- nhost_sdkBuilt on jwt_decoderDart SDK for Nhost authentication and file storage APIs.
- rest_api_clientBuilt on jwt_decoderHTTP client for REST APIs with JWT authentication, automatic token refresh, and response caching.