jaguar_jwt 0.2.0 copy "jaguar_jwt: ^0.2.0" to clipboard
jaguar_jwt: ^0.2.0 copied to clipboard

outdatedDart 1 only

JWT utilities for Jaguar.dart

example/example.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());
}
75
likes
0
pub points
96%
popularity

Publisher

unverified uploader

JWT utilities for Jaguar.dart

Homepage

License

unknown (license)

Dependencies

auth_header, dart_jwt

More

Packages that depend on jaguar_jwt