Strange issue with the 2-Factor Authentication market app

Recently i have implemented the 2-Factor Authentication market app to our owncloud server, as expected it works great but only for some users…

Expected behavior…
Click your user name and then click “Security”. a check box is displayed under the TOTP Second-factor Auth section, click the check box and a QR code will show up where you can scan and enter the code provided by the app in order to authenticate.

Unexpected behavior…
Click your user name and then click “Security”. a check box is displayed under the “TOTP Second-factor Auth” section, click the check box nothing happens.

The strange behavior is even more unexpected as most of the users can enroll as expected, only some are facing this issue.

Hey,

maybe you could use the issue template which i’m getting presented when creating a new thread in this “Server” category?

I think others are probably better able to help you if you provide more information about your environment (e.g. operating system, database, database version, specific database configuration). Those are all questions asked in that template which i think are asked for a good reason.

At the moment nearly everything is missing (e.g. possible entries from log files), even the ownCloud version you are using (e.g. an outdated ownCloud version could cause this problem). :frowning_face:

It seems also that https://marketplace.owncloud.com/apps/twofactor_totp lists a few different versions of the app depending on the ownCloud version, maybe you could also provide the app version which is currently used?

1 Like

My bad i rushed to the question and didn’t see the template.

app version = 5.3
owncloud version = 10.1.0.4
operating system = Linux
database management system = MySQL
MySQL version = 10.1.0.4

I cant see anything that stands out or will be helpful on the console logs :slight_smile:

Hey,

i think this looks quite outdated. Maybe you could update to the most recent version 10.4.1 to try to see if this is already solving your issue?

1 Like

I have the same issue on version 10.3.1.1

Uninstalling and re-installing the 2FA App in Marketplace did not help

On clicking “Activate 2FA” in Users Settings, the server responds with an “500 Internal Server Error”

https://____/index.php/apps/twofactor_totp/settings/enable
Status500
Internal Server Error
VersionHTTP/2

Hey,

i think you could find the reason for the “500 Internal Server Error” in the log files of the web server or directly within the owncloud.log.

indeed. owncloud.log has more details

{
"app" : "index",
"level" : 3,
"message" : "Exception: {\"Exception\":\"ParseError\",\"Message\":\"syntax error, unexpected '?', expecting variable (T_VARIABLE)\",\"Code\":0,\"Trace\":\"#0 \\/var\\/www\\/owncloud\\/lib\\/composer\\/composer\\/ClassLoader.php(322): Composer\\\\Autoload\\\\includeFile('\\/var\\/www\\/ownclo...')\\n#1 [internal function]: Composer\\\\Autoload\\\\ClassLoader->loadClass('BaconQrCode\\\\\\\\Ren...')\\n#2 \\/var\\/www\\/owncloud\\/apps\\/twofactor_totp\\/lib\\/Controller\\/SettingsController.php(137): spl_autoload_call('BaconQrCode\\\\\\\\Ren...')\\n#3 \\/var\\/www\\/owncloud\\/apps\\/twofactor_totp\\/lib\\/Controller\\/SettingsController.php(83): OCA\\\\TwoFactor_Totp\\\\Controller\\\\SettingsController->generateBase64EncodedQrImage('SECRETCODE')\\n#4 \\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(153): OCA\\\\TwoFactor_Totp\\\\Controller\\\\SettingsController->enable(true)\\n#5 \\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/Http\\/Dispatcher.php(85): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\TwoFactor_Totp\\\\Controller\\\\SettingsController), 'enable')\\n#6 \\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/App.php(100): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\TwoFactor_Totp\\\\Controller\\\\SettingsController), 'enable')\\n#7 \\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/Routing\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\TwoFactor_T...', 'enable', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#8 \\/var\\/www\\/owncloud\\/lib\\/private\\/Route\\/Router.php(342): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#9 \\/var\\/www\\/owncloud\\/lib\\/base.php(920): OC\\\\Route\\\\Router->match('\\/apps\\/twofactor...')\\n#10 \\/var\\/www\\/owncloud\\/index.php(54): OC::handleRequest()\\n#11 {main}\",\"File\":\"\\/var\\/www\\/owncloud\\/apps\\/twofactor_totp\\/vendor\\/bacon\\/bacon-qr-code\\/src\\/Renderer\\/RendererStyle\\/RendererStyle.php\",\"Line\":41}",
       "method" : "POST",
       "remoteAddr" : "cen.sor.e.d",
       "reqId" : "9VeAXXLjPl8kvGfjIlXN",
       "time" : "2020-09-08T14:17:14+00:00",
       "url" : "/owncloud/index.php/apps/twofactor_totp/settings/enable",
       "user" : "testuser"
    }
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('BaconQrCode\\Ren...')
#2 \/var\/www\/owncloud\/apps\/twofactor_totp\/lib\/Controller\/SettingsController.php(137): spl_autoload_call('BaconQrCode\\Ren...')
#3 \/var\/www\/owncloud\/apps\/twofactor_totp\/lib\/Controller\/SettingsController.php(83): OCA\TwoFactor_Totp\Controller\SettingsController->generateBase64EncodedQrImage('SECRETCODE')
#4 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(153): OCA\TwoFactor_Totp\Controller\SettingsController->enable(true)
#5 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(85): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\TwoFactor_Totp\Controller\SettingsController), 'enable')
#6 \/var\/www\/owncloud\/lib\/private\/AppFramework\/App.php(100): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\TwoFactor_Totp\Controller\SettingsController), 'enable')
#7 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\AppFramework\App::main('OCA\\TwoFactor_T...', 'enable', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#8 \/var\/www\/owncloud\/lib\/private\/Route\/Router.php(342): OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#9 \/var\/www\/owncloud\/lib\/base.php(920): OC\Route\Router->match('\/apps\/twofactor...')
#10 \/var\/www\/owncloud\/index.php(54): OC::handleRequest()
#11 {main}","File":"\/var\/www\/owncloud\/apps\/twofactor_totp\/vendor\/bacon\/bacon-qr-code\/src\/Renderer\/RendererStyle\/RendererStyle.php","Line":41}

You can open a bug report on https://github.com/owncloud/twofactor_totp/issues . Please, also include exact server, app and php version of yours to ticket. Thank you.

1 Like

For anyone who may be struggling with this.

https://doc.owncloud.com/server/admin_manual/installation/quick_guides/ubuntu_18_04.html#install-the-required-packages

php-imagick is one of the required extensions. So make sure to install that, and all the needed extensions. For example, on Ubuntu:

sudo apt install php-imagick
3 Likes