Two factor TOTP report / listing using occ?

Nextcloud version : 24.0.1
Operating system and version : nextcloud:latest docker with mysql 8.0 & nginx as rev proxy in front.

Nextcloud is running fine… Using the Two-Factor TOTP Provider App for 2-factor codes.

Without busting out a joined sql query, is there a way to get a list of users who have enabled 2FA using occ ?


Replying to myself…

I did just do a query, but would still be interested in knowing if there’s a more elegant way of doing it using occ etc

FYI, the query I used to get users with 2FA turned on is:

select json_extract(,'$.displayname.value') from oc_twofactor_totp_secrets join oc_accounts on oc_twofactor_totp_secrets.user_id=oc_accounts.uid;

“… more elegant …” is always depending on the point of view :wink:

You can e.g. try ./occ user:information <user> or ./occ twofactorauth:state <user> to get user settings displayed. Nevertheless you need to loop through the whole user list to get the desired information.

1 Like