django flutter jwt code example
Example: flutter jwt
import 'package:corsac_jwt/corsac_jwt.dart';
void main() {
var builder = new JWTBuilder();
var token = builder
..issuer = 'https://api.foobar.com'
..expiresAt = new DateTime.now().add(new Duration(minutes: 3))
..setClaim('data', {'userId': 836})
..getToken();
var signer = new JWTHmacSha256Signer('sharedSecret');
var signedToken = builder.getSignedToken(signer);
print(signedToken);
var stringToken = signedToken.toString();
var decodedToken = new JWT.parse(stringToken);
print(decodedToken.verify(signer));
var validator = new JWTValidator()
..issuer = 'https://api.foobar.com';
Set<String> errors = validator.validate(decodedToken);
print(errors);
}