getJwt method

Future<String> getJwt()

Implementation

Future<String> getJwt() async {
  final jwtData = await Sentc.getApi().decodeJwt(jwt: jwt);

  if (jwtData.exp <= DateTime.now().millisecondsSinceEpoch / 1000 + 30) {
    jwt = await Sentc.refreshJwt(jwt, refreshToken);

    final storage = Sentc.getStorage();

    await storage.set("user_data_$_userIdentifier", jsonEncode(this));
  }

  return jwt;
}