@ -330,6 +330,18 @@ class OAuth2Service extends SiteService {
return clients;
}
async getRandomClients (maxCount) {
const clients = await OAuth2Client.aggregate([
{
$match: { 'flags.isActive': true },
},
$sample: { size: maxCount },
]);
async getClientById (clientId) {
const client = await OAuth2Client
.findOne({ _id: clientId })