Admin:generate-code not working

Hello,

generating a code for a user via the cli with the command:

sudo -u www-data php ./occ twofactorauth:admin:generate-code test2fa

raises the following error:

In AbstractMySQLDriver.php line 115:

An exception occurred while executing ‘INSERT INTO oc_twofactor_admin_codes (user_id, code, expires) VALUES(?, ?, ?)’ with params [“test2fa”, “705103”, 1551345793]:

SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value

In PDOStatement.php line 107:

SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value

In PDOStatement.php line 105:

SQLSTATE[HY000]: General error: 1364 Field ‘id’ doesn’t have a default value

twofactorauth:admin:generate-code

Installation is Nextcloud 15.0.4 on Ubuntu 18.04.

Known issue: https://github.com/ChristophWurst/twofactor_admin/issues/20#issuecomment-442787975. I assume you’re using MariaDB 10.3.

This should be fixed with Nextcloud 16.

FYI: this has nothing to do with twofactor_totp, so I changed the category accordingly.

Thanks for the feedback, Christoph.

We are using MySQL 5.7.25 on this nc server.