Skip to content

Instantly share code, notes, and snippets.

@zuhairkareem
Created October 18, 2021 10:01
Show Gist options
  • Save zuhairkareem/c33efbf785b18641b3b4c1999bb7be89 to your computer and use it in GitHub Desktop.
Save zuhairkareem/c33efbf785b18641b3b4c1999bb7be89 to your computer and use it in GitHub Desktop.
delete all oAuth2 tokens - Drupal 8/9
<?php

$query = \Drupal::entityTypeManager()->getStorage('oauth2_token')->getQuery();
$entity_ids = $query->execute();


$results = \Drupal::entityTypeManager()->getStorage('oauth2_token')->loadMultiple(array_values($entity_ids));

//var_dump($results);
\Drupal::entityTypeManager()->getStorage('oauth2_token')->delete($results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment