Search for users by authorized applications

Hi, is there any way to search in the dashboard for all users by the applications they authorized? Maybe by Lucene syntax?

Hey there!

I’m not sure if I understand your usecase correctly. Can you expand on that?

From the dashboard, after I click on Users & Roles → Users, I want to search for users according to the applications they have authorized. E.g. all users that have app x under the Authorized Applications tab when I click on that user. Is that possible?

Hey there!

Unfortunately that’s not possible. It would be doable via our Management API but I checked it and it’s not there. I suggest filing a feature request to our product team via our product feedback form:

Problem solved using management API & PHP.

<?php
require './vendor/autoload.php';

use Auth0\SDK\API\Management;

if(!isset($_POST['access_token'])||!isset($_POST['domain'])){
?>
<form method="post">
<p><input type="text" name="domain" placeholder="Domain"/></p>
<p><textarea name="access_token" placeholder="Access Token"></textarea></p>
<p><input type="submit"/></p>
</form>
<?php
}else{

$mgmt_api=new Management($_POST['access_token'],$_POST['domain']);

$clients=$mgmt_api->clients()->getAll();

$allUsers=[];

$userPage=null;
$page=0;
do{
	$userPage=$mgmt_api->users()->getAll([],null,null,$page++,100);
	foreach($userPage as $user){
		$allUsers[$user['user_id']]=$user;
	}
}while(is_array($userPage)&&count($userPage)>=100);

$uniqueUsers=[];

foreach($clients as $client){

	if($client['name']==='All Applications')continue;

	$users=[];

	$results=$mgmt_api->grants()->getByClientId($client['client_id']);

	foreach($results as $grant){
		$uniqueUsers[$grant['user_id']]=$users[$grant['user_id']]=$allUsers[$grant['user_id']];
	}

	$number=0;
?>
<h1>
<?php if(isset($client['logo_uri'])){ ?>
<img src="<?php echo $client['logo_uri']; ?>" style="max-width:64px;max-height:64px"/>
<?php } echo $client['name']; ?></h1>
<table>
<tr>
<th>S/N</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>User ID</th>
<th>Full JSON</th>
</tr>
<?php
	foreach($users as $user_id=>$user){
?>
<tr>
<td><?php echo ++$number; ?></td>
<td><?php echo $user['name']; ?></td>
<td><?php echo $user['email']; ?></td>
<td><?php echo $user['phone_number']; ?></td>
<td><?php echo $user_id ?></td>
<td><?php echo json_encode($user); ?></td>
</tr>
<?php
	}
?>
</table>
<?php
}
?>
Total unique users: 
<?php
echo count($uniqueUsers);
}
?>
1 Like

Perfect! Thanks for sharing that with the rest of community!

1 Like