public function AccessTokenUserList::tokenList in Simple OAuth (OAuth2) & OpenID Connect 8
Provide a list of tokens.
1 string reference to 'AccessTokenUserList::tokenList'
File
- src/
Controller/ AccessTokenUserList.php, line 14
Class
Namespace
Drupal\simple_oauth\ControllerCode
public function tokenList(User $user) {
$entity_type = 'access_token';
$storage = $this
->entityManager()
->getStorage($entity_type);
$ids = $storage
->getQuery()
->condition('auth_user_id', $user
->id())
->execute();
if (empty($ids)) {
return [
'#markup' => $this
->t('There are no tokens for this user.'),
];
}
$view_controller = $this
->entityManager()
->getViewBuilder($entity_type);
$tokens = $storage
->loadMultiple($ids);
return $view_controller
->viewMultiple($tokens);
}