logoutOthers method

Future<void> logoutOthers(
  1. dynamic userId,
  2. String currentToken
)

Logs out the user from other devices (invalidates all tokens except current)

userId The user ID currentToken The current token to keep active

Implementation

Future<void> logoutOthers(dynamic userId, String currentToken) async {
  // Get all tokens for this user and guard
  final tokens = await repository.findTokensByUser(userId, providerKey);

  // Delete all tokens except the current one
  for (final tokenData in tokens) {
    final token = tokenData['token'] as String;
    if (token != currentToken) {
      await repository.deleteToken(token);
    }
  }
}