RefreshToken constructor

RefreshToken(
  1. String originalToken
)

Creates a new RefreshToken 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 refresh token.

Implementation

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