AuthToken.parse constructor

AuthToken.parse(
  1. String jwt
)

Implementation

factory AuthToken.parse(String jwt) {
  var split = jwt.split('.');

  if (split.length != 3) {
    _log.warning('Invalid JWT');
    throw AngelHttpException.notAuthenticated(message: 'Invalid JWT.');
  }

  var payloadString = decodeBase64(split[1]);
  return AuthToken.fromMap(
      json.decode(payloadString) as Map<String, dynamic>);
}