jwt_decode
0.3.1, released 6 years ago by imsid.xyz
A Dart package to decode JSON Web Tokens, check expiry dates, and verify expiration status.
WASM-ready
What it does
It decodes JSON Web Tokens (JWT) into a Map of their payload data, retrieves the token's expiry date, and checks if the token has expired. It is implemented as a pure Dart package with no external dependencies.
AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to decode JWT payloads on the client side in a Dart or Flutter application.
- You need to quickly check if a JWT is expired without implementing custom base64 and JSON parsing logic.
Skip it when
- You need to cryptographically verify or sign JWT tokens (this package only decodes and checks claims).
- You are looking for a comprehensive authentication and session management provider.
Strengths
- Simple top-level functions for parsing, getting expiry dates, and checking expiration.
- Zero external dependencies.
- Supports all platforms including Android, iOS, Web, Windows, macOS, and Linux.
Weaknesses
- Does not perform cryptographic signature verification of the tokens.
- Limited feature set beyond simple decoding and expiration checks.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:jwt_decode/jwt_decode.dart';
String token = 'your_jwt_token_here';
Map<String, dynamic> payload = Jwt.parseJwt(token);
DateTime? expiryDate = Jwt.getExpiryDate(token);Alternatives
Packages that do the same job and could replace jwt_decode.
- dart_jsonwebtoken
A Dart library for creating, signing, decoding and verifying JSON Web Tokens (JWT).
81Compare - corsac_jwt
Lightweight implementation of JSON Web Tokens (JWT) for Dart and Flutter.
58Compare - selective_disclosure_jwt
Dart SDK for working with Selective Disclosure JSON Web Tokens (SD-JWT)
58Compare