jwt_token_generator 1.2.0 copy "jwt_token_generator: ^1.2.0" to clipboard
jwt_token_generator: ^1.2.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 #

  1. Instantiate JWT class.
  2. Declare the payload.
  3. 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');

To validate JWT #

  1. Instantiate JWT class.
  2. Use validate JWT method.
JWT jwt = JWT();
bool isValidated = await jwt.verifyTokey(token: token, secretKey: secretKey);
print(isValidated);// True or False

Additional information #

Currently supported algorithm: HS256 will be adding more algorithm soon or if you want to contribute you are welcome.

1
likes
150
points
64
downloads

Publisher

verified publisheranonymus-publisher.online

Weekly Downloads

A package that generates jwt tokens with a few steps

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

cryptography

More

Packages that depend on jwt_token_generator