logout static method

Future<Map<String, Object?>> logout(
  1. Client cloudApiClient, {
  2. required String localStoragePath,
  3. required List<String> tokenIds,
  4. required bool all,
})

Implementation

static Future<Map<String, Object?>> logout(
  final Client cloudApiClient, {
  required final String localStoragePath,
  required final List<String> tokenIds,
  required final bool all,
}) async {
  final currentSessionLoggedOut = await _logoutDevices(
    cloudApiClient,
    tokenIds,
    all,
  );

  if (currentSessionLoggedOut) {
    try {
      await ResourceManager.removeServerpodCloudAuthData(
        localStoragePath: localStoragePath,
      );
    } on Exception catch (e, s) {
      throw FailureException.nested(
        e,
        s,
        'Failed to remove stored credentials',
        'Please remove these manually. '
            'They should be located in $localStoragePath.',
      );
    }
  }

  return {'currentSessionLoggedOut': currentSessionLoggedOut};
}