nextcloud / twofactor_totp

🔑 Second factor TOTP (RFC 6238) provider for Nextcloud
https://apps.nextcloud.com/apps/twofactor_totp
GNU Affero General Public License v3.0
294 stars 56 forks source link

Can't enable TOTP #177

Closed StrangeMonkey closed 6 years ago

StrangeMonkey commented 7 years ago

Hi,

My issue is the following : i can't enbale TOTP, the circle is turning indefinitely. bug_totp

I think this problem is responsible for the non-use of TOTP.

Thanks for helping. StrangeMonkey

ChristophWurst commented 7 years ago

Hi @StrangeMonkey,

please provide more information about your setup and steps to reproduce this.

Thanks

StrangeMonkey commented 7 years ago

Hi @ChristophWurst

I only have this logs on nextcloud : include_once(/var/www/nextcloud/apps/twofactor_totp/appinfo/../vendor/autoload.php): failed to open stream: No such file or directory at /var/www/nextcloud/apps/twofactor_totp/appinfo/app.php#23

include_once(): Failed opening '/var/www/nextcloud/apps/twofactor_totp/appinfo/../vendor/autoload.php' for inclusion (include_path='/var/www/nextcloud/3rdparty/pear/console_getopt:/var/www/nextcloud/3rdparty/pear/pear_exception:/var/www/nextcloud/3rdparty/pear/archive_tar:/var/www/nextcloud/3rdparty/pear/pear-core-minimal/src:/var/www/nextcloud/apps') at /var/www/nextcloud/apps/twofactor_totp/appinfo/app.php#23

Thanks for your answer.

ChristophWurst commented 7 years ago

Which version of the app are you using? Nextcloud App Store

Based on this vague information, I'm assuming you've installed the latest stable version 1.3.0. I manually checked it and the archive contains the file that apparently is missing on your setup.

Even though you stated to have installed the app via the app store, this looks like you downloaded the source zip from GitHub. That would explain why the php denpendencies directory (vendor) is missing.

StrangeMonkey commented 7 years ago

The circle is turning indefinitely but i have the QrCode : And can scan it with FreeOTP and when i enter the key, i've this message :

Impossible to check your key. Please retry.

Thanks for your precedent answer

ChristophWurst commented 7 years ago

Again, to be able to help you with your problem you have to provide more information about what steps you took so far and what errors messages are shown where if you do what.

StrangeMonkey commented 7 years ago

Ok.

  1. Downloading twofactor from the NextCloud 12 AppStore
  2. Enable the twofactor app in the application pannel
  3. On my personnal pannel, i'm going in the twofactor authentication section and click on "Activate single usage password (TOTP) and the circle is turning indefinitely
  4. The twofactor app provide me a TOTP secret and a QRcode
  5. On my FreeOTP app for Android, i'm scanning the QRcode and FreeOTP give me a key
  6. I enter this key in the fields just after the QRcode, click on verify and i have this message "Impossible to check your key. Please retry."

And don't have any log in my administration pannel. The issue about the missing files seems to be resolve after reinstalling the app.

StrangeMonkey

ChristophWurst commented 7 years ago

Thanks for providing more details for this issues!

StrangeMonkey commented 7 years ago

Can i help for something to debug ?

ChristophWurst commented 7 years ago

Yes, I think it would help to check data/nextcloud.log for possibly logged errors.

I'd also be interested in the HTTP status returned by the server. You can find that by opening the developer console, switch to the network tab and retry to enter a verification code. That should trigger a request to the server.

armorica commented 7 years ago

Similar/same problem here. Debian 8.0 server, all updates; Nextcloud 12.0.0, TOTP app 1.3.0. No errors at all in any of the logs. QR code appears, but 'enabling circle' keeps turning. After reload of page, checkbox is unchecked; TOTP not enabled.

Not sure if this what you asked StrangeMonkey, but opening a Web developer console in FF, this is the response header when entering a code (while the activation wheel is still spinning):

Cache-Control: no-cache, no-store, must-revalidate Connection: Keep-Alive Content-Length: 11 Content-Security-Policy: default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-WS9xWEtLOEM3cDNUM0E0MGNVSWpzbmdyNlIrZjBWcTA5TGdrK2N3THM1az06QjV6OVF1azZoNmpucWlGakZBOTI5QmxBaDBuR3FXclF0dWhGMXE4Lys2MD0=' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self' Content-Type: application/json; charset=utf-8 Date: Sun, 02 Jul 2017 13:59:15 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=100 Pragma: no-cache Server: Apache/2.4.10 (Debian) X-Content-Type-Options: nosniff X-Download-Options: noopen X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-Robots-Tag: none strict-transport-security: max-age=15552000; includeSubDomains x-xss-protection: 1; mode=block

Validation fails.

armorica commented 7 years ago

Like StrangeMonkey I'm willing to do more logging/debugging. Funny thing is, I got it working on another server (same OS/NC/App) without any problems.

Forgot to mention; server (both) are behind reverse proxy.

armorica commented 7 years ago

I wasn't telling the truth about the servers being identical; background process in my head told me while walking the dog :)

They are now; I upgraded the server with the issue PHP 5.6 to 7.0.20 now; didn't solve the problem though. Just for completeness.

ChristophWurst commented 7 years ago

Yes, I think it would help to check data/nextcloud.log for possibly logged errors.

I'd also be interested in the HTTP status returned by the server. You can find that by opening the developer console, switch to the network tab and retry to enter a verification code. That should trigger a request to the server.

Could anyone of you please provide that information? That would help a lot.

armorica commented 7 years ago

Ok, good news! Fixed it. Going through the code and thinking about what may go wrong and what the system requirements are, I suddenly knew it would have to be my system clock being slightly wrong. Installed ntp, and voila... Stupid me;should have considered that first thing.

Hope this works for StrangeMonkey too.

ChristophWurst commented 7 years ago

system clock being slightly wrong

Great to hear it was that simple to fix once you know where the problem comes from 😉

hanzei commented 7 years ago

I encountered the same problem as @StrangeMonkey

{"reqId":"zd7Ro3RbLDIK2e2hg1G6","level":3,"time":"2017-08-23T10:12:32+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/settings\/user\/additional","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"zd7Ro3RbLDIK2e2hg1G6","level":3,"time":"2017-08-23T10:12:32+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/settings\/user\/additional","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"OyJH4zmX81MxdXplnYjT","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/css\/core\/8422af5e95175a58af85864ca60d24f1-server.css?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"OyJH4zmX81MxdXplnYjT","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/css\/core\/8422af5e95175a58af85864ca60d24f1-server.css?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"2DZuI1t0SW5oqEMrzC4m","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/css\/core\/8422af5e95175a58af85864ca60d24f1-share.css?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"2DZuI1t0SW5oqEMrzC4m","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/css\/core\/8422af5e95175a58af85864ca60d24f1-share.css?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"2DZuI1t0SW5oqEMrzC4m","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/css\/core\/8422af5e95175a58af85864ca60d24f1-share.css?v=a900d3c975a0afbec80a417e67d282b7-0","message":"PHP Startup: Unable to load dynamic library '\/usr\/lib\/php\/20151012\/bz2.so' - \/usr\/lib\/php\/20151012\/bz2.so: cannot open shared object file: No such file or directory at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"JxRGzKqmq2r5EIrst4M8","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/theming\/styles?v=0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"JxRGzKqmq2r5EIrst4M8","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/theming\/styles?v=0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"JxRGzKqmq2r5EIrst4M8","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/theming\/styles?v=0","message":"PHP Startup: Unable to load dynamic library '\/usr\/lib\/php\/20151012\/bz2.so' - \/usr\/lib\/php\/20151012\/bz2.so: cannot open shared object file: No such file or directory at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"vLFcCJtCMeWbWuqsr9uW","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/js\/core\/merged-template-prepend.js?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"vLFcCJtCMeWbWuqsr9uW","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/js\/core\/merged-template-prepend.js?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"b89J8T0lgez9bhlQClic","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/js\/core\/merged-share-backend.js?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"b89J8T0lgez9bhlQClic","level":3,"time":"2017-08-23T10:12:33+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/js\/core\/merged-share-backend.js?v=a900d3c975a0afbec80a417e67d282b7-0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"ebJnspQuRgdJUNinvx5g","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/theming\/js\/theming?v=0","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"ebJnspQuRgdJUNinvx5g","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/theming\/js\/theming?v=0","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"Su8DOU6xRHKEaXc3mTSC","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/cron.php","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"Su8DOU6xRHKEaXc3mTSC","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/cron.php","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"98TCVsiflPsC56Ax4EjI","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/twofactor_totp\/settings\/state","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"98TCVsiflPsC56Ax4EjI","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/apps\/twofactor_totp\/settings\/state","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"b1eXuPIidILPZLKTEMog","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/settings\/ajax\/checksetup","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"b1eXuPIidILPZLKTEMog","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/settings\/ajax\/checksetup","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"1PxUwlfDBuKJtJ6ZTSb5","level":3,"time":"2017-08-23T10:12:34+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/heartbeat","message":"PHP Startup: Unable to load dynamic library '\/usr\/lib\/php\/20151012\/bz2.so' - \/usr\/lib\/php\/20151012\/bz2.so: cannot open shared object file: No such file or directory at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"b1eXuPIidILPZLKTEMog","level":3,"time":"2017-08-23T10:12:35+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"GET","url":"\/nextcloud\/index.php\/settings\/ajax\/checksetup","message":"PHP Startup: Unable to load dynamic library '\/usr\/lib\/php\/20151012\/bz2.so' - \/usr\/lib\/php\/20151012\/bz2.so: cannot open shared object file: No such file or directory at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"9YetGQd9BmsMkRgVlL7t","level":3,"time":"2017-08-23T10:12:38+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"POST","url":"\/nextcloud\/index.php\/apps\/twofactor_totp\/settings\/enable","message":"include_once(\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php): failed to open stream: No such file or directory at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"9YetGQd9BmsMkRgVlL7t","level":3,"time":"2017-08-23T10:12:38+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"PHP","method":"POST","url":"\/nextcloud\/index.php\/apps\/twofactor_totp\/settings\/enable","message":"include_once(): Failed opening '\/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/..\/vendor\/autoload.php' for inclusion (include_path='\/var\/www\/html\/nextcloud\/3rdparty\/pear\/console_getopt:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear_exception:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/pear-core-minimal\/src:\/var\/www\/html\/nextcloud\/3rdparty\/pear\/archive_tar:\/var\/www\/html\/nextcloud\/apps') at \/var\/www\/html\/nextcloud\/apps\/twofactor_totp\/appinfo\/app.php#23","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
{"reqId":"9YetGQd9BmsMkRgVlL7t","level":3,"time":"2017-08-23T10:12:38+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"index","method":"POST","url":"\/nextcloud\/index.php\/apps\/twofactor_totp\/settings\/enable","message":"Exception: {\"Exception\":\"Error\",\"Message\":\"Class 'Otp\\\\GoogleAuthenticator' not found\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/nextcloud\\\/apps\\\/twofactor_totp\\\/lib\\\/Controller\\\/SettingsController.php(85): OCA\\\\TwoFactorTOTP\\\\Service\\\\Totp->createSecret(Object(OC\\\\User\\\\User))\\n#1 [internal function]: OCA\\\\TwoFactorTOTP\\\\Controller\\\\SettingsController->enable(1, NULL)\\n#2 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\TwoFactorTOTP\\\\Controller\\\\SettingsController), 'enable')\\n#4 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\TwoFactorTOTP\\\\Controller\\\\SettingsController), 'enable')\\n#5 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\TwoFactorTO...', 'enable', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#6 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#7 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(297): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#8 \\\/var\\\/www\\\/html\\\/nextcloud\\\/lib\\\/base.php(1004): OC\\\\Route\\\\Router->match('\\\/apps\\\/twofactor...')\\n#9 \\\/var\\\/www\\\/html\\\/nextcloud\\\/index.php(40): OC::handleRequest()\\n#10 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/nextcloud\\\/apps\\\/twofactor_totp\\\/lib\\\/Service\\\/Totp.php\",\"Line\":75}","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"13.0.0.3"}
ChristophWurst commented 7 years ago

this is undefined

Try adding var _this = this; after https://github.com/nextcloud/twofactor_totp/blob/master/js/settingsview.js#L206 and change this to _this in the promise callback.

hanzei commented 7 years ago

Try adding var _this = this; after https://github.com/nextcloud/twofactor_totp/blob/master/js/settingsview.js#L206 and change this to _this in the promise callback.

This sadly didn't fix the problem

Maikewng commented 6 years ago

I've began to encounter the same problem as soon as I disabled some default apps that come pre-activated with the nextcloud tarball. Before that, TOTP was working without any issue. Maybe there's some kind of app-dependence? I'm using Nextcloud 13 on Raspbian, let me know how I can help.

ChristophWurst commented 6 years ago

I've began to encounter the same problem as soon as I disabled some default apps that come pre-activated with the nextcloud tarball. Before that, TOTP was working without any issue. Maybe there's some kind of app-dependence?

It would help a lot to know which specific apps you've disabled.

Maikewng commented 6 years ago

The disabled apps are: Activity, Collaborative Tags, Comments, Federation. Re-enabling them doesn't make it work either. Unfortunately i don't have any log, since thanks to this issue I just discovered Nextcloud didn't have write permissions to the logfile.

Maikewng commented 6 years ago

Small update: I noticed that while on my laptop (Windows 10 + Firefox 58) login is remembered even without TOTP, on my phone (Android MIUI 9 + Firefox 58) it is not possible to get a persistent login. If I tap on "Stay logged in" it just reloads the login page. It wasn't happening before the TOTP issue (which in turn happened after enabling/disabling the aforementioned apps).

EDIT: I also managed to get the log, but it doesn't say a single thing about TOTP. What can I do more to help?

powerbridge commented 6 years ago

Hi,

I just installed Nextcloud 13.0.1 and am having this same issue with a fresh install. I have checked my time (and enabled ntp), but the problem remains. When I click on "Enable TOTP," a QR code appears and a spinning icon displays next to "Enable TOTP." I can scan the QR code using Google Authenticator, but when I try to enter a code into the next field it says "Could not verify your key. Please try again."

Does anyone have any update on this issue? Hanzei? StrangeMonkey? ChristophWurst, I'm happy to run any tests you can think of.

powerbridge commented 6 years ago

I just installed Nextcloud (v13.0.1) from the tarball in a new Ubuntu VM, installed the Two Factor TOTP Provider (v1.4.1) and am still having the same issues I described above. If there's anything I can do to help troubleshoot, I'd be glad to do it.

zoide commented 6 years ago

Same thing here :( I've tried all OTP Android clients that are available. None of them do.

ChristophWurst commented 6 years ago

Could someone please create a test account on their instance and send me the credentials via email? I will give it a test then. I still cannot reproduce this on my instances.

powerbridge commented 6 years ago

Hi Christoph,

I just setup an account for you and sent you an email. Thanks so much for looking into this!

ChristophWurst commented 6 years ago

Thanks! As mentioned in the email reply, I was able to log into your instance and enable and use the TOTP app. What browsers are you using?

ChristophWurst commented 6 years ago

FYI I'm using this app: https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp and I scanned the QR code with the integrated scanner - maybe that makes a difference.

zoide commented 6 years ago

I'm using Chromium Version 64.0.3282.119 (Developer Build) built on Debian 9.3, running on Debian 9.4 (64-bit)

ChristophWurst commented 6 years ago

I'm using Chromium Version 64.0.3282.119 (Developer Build) built on Debian 9.3, running on Debian 9.4 (64-bit)

Just tried with Version 65.0.3325.162 (Developer-Build) (64-Bit) on Arch Linux and I could successfully set up and use this app on @powerbridge's instance.

powerbridge commented 6 years ago

Thanks for checking on this Christoph. I'm glad you got it working. Hopefully I can reproduce. I have tested this from a Mac running Safari 11.0.3 (13604.5.6), Chrome 65.0.3325.162 and Firefox 59.0.1--no luck from those browsers.

Let me test using some other browsers on other platforms. I was testing with Google Authenticator. Let me also try with FreeOTP.

zoide commented 6 years ago

I've tried the freeOTP you used from F-Droid. And all other that you can find there: https://f-droid.org/packages/net.bierbaumer.otp_authenticator https://f-droid.org/packages/org.fedorahosted.freeotp https://f-droid.org/packages/org.shadowice.flocke.andotp

ChristophWurst commented 6 years ago

If one of you can reproduce the bug in a desktop browser, please open the developer console and check if there are any errors in the console tab or any of the HTTP requests in the network tab return a non-200 status code. It helps a lot to clear both these tabs before you try to enable TOTP, otherwise there are many unrelated entries, especially in the network tab. So

zoide commented 6 years ago

Did it, nothing in Console and only 200 status codes in the network tab.

ChristophWurst commented 6 years ago

@zoide if possible, please see https://github.com/nextcloud/twofactor_totp/issues/177#issuecomment-374565207 and send me credentials to a test account. I'll try to reproduce the bug on your instance.

Maikewng commented 6 years ago

Actually, with me the problem arose while using the same browser, the same OS and the same notebook. It also happens on my browser's phone, and before it was working everywhere. I believe it should be more related to accounts rather than browsers and devices: it's strange that it worked under a new account made just for @ChristophWurst

zoide commented 6 years ago

ah, I have only LDAP-Accounts, the one you just got, Christoph is a local/internal one.

powerbridge commented 6 years ago

I'm getting nothing in the console and only 200 status codes in the network tab as well. I just tested this with Edge and Chrome in Windows 10, but I have the same issue I have with Safari, Chrome and Firefox on the Mac side.

Christoph, I'm really at a loss as to how you enabled this for the account I setup for you. Did you leave 2FA enabled? I only ask because I tried to login as you to reproduce and I could get in without 2FA.

I have LDAP setup as well, but the account I created for Christoph was a local admin account.

Finally, I tried scanning the QR code using FreeOTP. Like Google Authenticator, it scans and provides me with codes, but the spinning circle (that was previously the "Enable TOTP" checkbox) never goes away, and if I refresh the page, it goes back to the unchecked "Enable TOTP" checkbox.

ChristophWurst commented 6 years ago

Christoph, I'm really at a loss as to how you enabled this for the account I setup for you. Did you leave 2FA enabled? I only ask because I tried to login as you to reproduce and I could get in without 2FA.

I disabled it :wink:

Maikewng commented 6 years ago

@ChristophWurst you also have a test account on my instance if necessary. Check your mail.

ChristophWurst commented 6 years ago

So on @zoide's account I can see that the web interface sends a request with {key: xxx, state: 2} which indicates that it wants to finish the setup. The response is {state: 1} (disabled), so the verification fails. The only code path that leads to this response is here and here. I'm out of ideas on how to debug this without having access to the server. Too bad I cannot reproduce this locally, because there I could attach a debugger and step through the code.

ChristophWurst commented 6 years ago

@Maikewng FYI the credentials you've sent are invalid. I cannot log into your instance.

ChristophWurst commented 6 years ago

… sends a request with {key: xxx, state: 2} which indicates that it wants to finish the setup. The response is {state: 1} (disabled) …

FTR, these are the states: https://github.com/nextcloud/twofactor_totp/blob/920fa2a55a4f7ad19e9a1a056e83f59a0db46c5c/lib/Service/ITotp.php#L31-L33

Hence the requests/responses are OK. We just have to find out why the submitted code is considered wrong by the OTP library.

Maikewng commented 6 years ago

My bad, I fixed it now.

ChristophWurst commented 6 years ago

Hooray, was able to set up TOTP on @Maikewng's account as well, so yours and @powerbridge's instances work for me, while @zoide's doesn't. This is weird.

Maikewng commented 6 years ago

How did you accomplish it @ChristophWurst? Now I managed to set it up on my account as well, is it normal that the checkbox keeps circling until I verify the QRcode with the app?

ChristophWurst commented 6 years ago

Just to be sure we're not working with wrongly set up instances here: are these three instances based on the official tarball/zip and was the app installed via the app settings on the web interface?

ChristophWurst commented 6 years ago

How did you accomplish it @ChristophWurst? Now I managed to set it up on my account as well, is it normal that the checkbox keeps circling until I verify the QRcode with the app?

Yes, because without confirmation, the app won't ask for the TOTP on login as otherwise an interrupted setup process would lock you out of your account. Therefore the three states: disabled, created and enabled.

powerbridge commented 6 years ago

Yes, indeed. I used the official tarball/zip and installed the app via the web interface.