jwt_token_generator 1.0.0
jwt_token_generator: ^1.0.0 copied to clipboard
A package that generates jwt tokens with a few steps
A JWT token generator package for flutter and dart.
Features #
Generate HS256 algorithm jwt token.
Getting started #
Add the depency to pubspec.yaml and start using its methods.
Usage #
- Instantiate JWT class.
- Declare the payload.
- Use generateToken method.
JWT jwt = JWT();
Map<String, dynamic> payload = {
'iss': 'localhost',
'exp': DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch / 1000,
'id': 1,
'fullname': 'User name'
};
String token = await jwt.generateToken(payload: payload, secretKey: 'SampleKey');
Additional information #
Currently supported algorithm: HS256 will be adding more algorithm soon or if you want to contribute you are welcome.