AccessToken constructor

AccessToken(
  1. String originalToken
)

Creates a new AccessToken from the given string.

The originalToken-String should contain header, payload and the signature base64 encoded. Calls super constructor.

Throws FormatException if JsonWebToken constructor throws it and if the token type in the payload is not compatible with an access token.

Implementation

AccessToken(String originalToken) : super(originalToken) {
  if (!decodedPayload.containsKey(_payloadKeyType)) {
    throw const FormatException('Not type claim in payload');
  }
  if (decodedPayload[_payloadKeyType] != _payloadValueAccessTokenType) {
    throw const FormatException('Wrong type claim in payload');
  }
}