jwt_decode_token 1.0.0 jwt_decode_token: ^1.0.0 copied to clipboard
A starting point for Dart libraries or applications.
A library for decoding a JWT token to extract the payload.
Usage #
A simple usage example:
import 'package:jwt_decode_token/jwt_decode_token.dart';
main() {
String token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiMSIsInVzZXJuYW1lIjoiZGFydHNvY2lldHkiLCJlbWFpbCI6ImhlbGxvQGRhcnRzb2NpZXR5LmRldiJ9LCJpYXQiOjE1ODc3NzIyMTUsImV4cCI6MTU5MDM2NDIxNX0.ixXHGIxVXsbhkV5fUO11RG84cxebOlVVjrBa7rkcUXY';
Map<String, dynamic> payload = decodeJwt(token);
print(payload);
// --> {user: {id: 1, username: dartsociety, email: hello@dartsociety.dev}, iat: 1587772215, exp: 1590364215}
}
Features and bugs #
Please file feature requests and bugs at the issue tracker.