fetchTokenData static method

Future<Map<String, dynamic>?> fetchTokenData({
  1. String decrypter(
    1. String ciphertext
    )?,
})

Returns a token for remote access along with its refresh token, expiration date, and type.

decrypter When the old tokens are read from local storage, they are decrypted. This parameter allows you to provide your own decryption method. This will be used in addition to the default decryption method. This will be performed after the default decryption method.

If the token is not found, returns null.

Implementation

static Future<Map<String, dynamic>?> fetchTokenData({
  String Function(String ciphertext)? decrypter,
}) async {
  /// The state token data that is stored in local storage.
  String? storedTokenDataStr = await LocalStorageRepo.read(
    folder: Folder.remoteTokens,
    fileName: remoteTokenFile,
    decrypter: decrypter,
  );

  if (storedTokenDataStr == null) return null;

  return JsonTool.readJson(storedTokenDataStr);
}