jaguar_jwt 0.2.0 jaguar_jwt: ^0.2.0 copied to clipboard
JWT utilities for Jaguar.dart
library jaguar_jwt.example;
import 'package:dart_jwt/dart_jwt.dart';
import 'package:jaguar_jwt/jaguar_jwt.dart';
void main() {
//Issuing a JWT token
final encoder = new AuthenticationConf.SymmetricKey(
'dfsdffasdfdgdfgdfg456456456', 'teja',
audience: <String>['admin', 'students']);
ClaimSet claimSet =
new ClaimSet('kleak', encoder.issuer, encoder.audience, {'k': 'v'});
String encoded = encoder.encodeClaimSet(claimSet);
print(encoded);
//Decoding a token
final decoder = new AuthorizationConf.SymmetricKey(
'dfsdffasdfdgdfgdfg456456456', 'teja',
audience: <String>['students']);
JsonWebToken decoded = decoder.decodeToken(encoded);
print(decoded.claimSet.toJson());
}