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

outdatedDart 1 only

JWT interceptor and utilities for Jaguar

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 JwtAuthenticationContext(
      new JwaSymmetricKeySignatureContext('dfsdffasdfdgdfgdfg456456456'),
      'teja',
      audience: <String>['admin', 'students']);

  JaguarJwtClaimSet claimSet = new JaguarJwtClaimSet(
      'kleak', encoder.issuer, encoder.audience, {'k': 'v'});
  String encoded = encoder.encodeClaimSet(claimSet);
  print(encoded);

  //Decoding a token
  final decoder = new JwtAuthorizationContext(
      new JwaSymmetricKeySignatureContext('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 interceptor and utilities for Jaguar

Homepage

License

unknown (license)

Dependencies

auth_header, dart_jwt

More

Packages that depend on jaguar_jwt