nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.3k stars 1.77k forks source link

Nextcloud keep asking account password #2811

Closed labatt24 closed 5 years ago

labatt24 commented 6 years ago

Actual behaviour

Environment data

Android version:

Device model: LGV20

Stock or customized system: Stock

Nextcloud app version: 3.20

Nextcloud server version: 10.0.1

Logs

Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)

{"reqId":"ccwJWQrilNICO98UCwfq","remoteAddr":"204.48.94.223","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 CSRF check not passed.\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php(155): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->auth(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php(166): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->check(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(446): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#5 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(60): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/remote.php(165): require_once('\\\/usr\\\/pbi\\\/nextcl...')\\n#8 {main}\",\"File\":\"\\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php\",\"Line\":220,\"User\":\"guyl\"}","level":0,"time":"2018-07-07T22:24:59+00:00","method":"PROPFIND","url":"\/remote.php\/webdav\/","user":"guyl"}
{"reqId":"\/ozQp9nNLA1WTn\/pCciK","remoteAddr":"204.48.94.223","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(446): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(60): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/remote.php(165): require_once('\\\/usr\\\/pbi\\\/nextcl...')\\n#6 {main}\",\"File\":\"\\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":188,\"User\":false}","level":0,"time":"2018-07-07T22:25:00+00:00","method":"HEAD","url":"\/remote.php\/webdav\/","user":"--"}
{"reqId":"vaDAisOPJOEH1g8Sn0sI","remoteAddr":"204.48.94.223","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 CSRF check not passed.\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php(155): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->auth(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php(166): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->check(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(446): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#5 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(60): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/remote.php(165): require_once('\\\/usr\\\/pbi\\\/nextcl...')\\n#8 {main}\",\"File\":\"\\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php\",\"Line\":220,\"User\":\"guyl\"}","level":0,"time":"2018-07-07T22:25:10+00:00","method":"PROPFIND","url":"\/remote.php\/webdav\/","user":"guyl"}
{"reqId":"m7OrMhNyvhXja7gSuqpU","remoteAddr":"204.48.94.223","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(446): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(60): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/remote.php(165): require_once('\\\/usr\\\/pbi\\\/nextcl...')\\n#6 {main}\",\"File\":\"\\\/usr\\\/pbi\\\/nextcloud-amd64\\\/www\\\/nextcloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":188,\"User\":false}","level":0,"time":"2018-07-07T22:25:10+00:00","method":"HEAD","url":"\/remote.php\/webdav\/","user":"--"}

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

labatt24 commented 6 years ago

I want to add I'm using Nextcloud plugin on FreeNAS. Last version of the plugin : 10.0.1

oleszczyk commented 6 years ago

Same issue: Xiaomi Mi A1, stock OS. Application is not usable at all.

chenz commented 6 years ago

Same here with server version 12.0.4, the app (version 3.2.1) still kind of works, but the login screen keeps popping up all the time.

I have since upgraded to server version 13.0.4, and that seems to have fixed the issue.

chenz commented 6 years ago

Spoke too soon - login screen pops up again now.

gjedeer commented 6 years ago

Same here:

{"reqId":"eSU01CFbver4tFSE7iWl","level":1,"time":"2018-08-16T06:15:55+00:00","remoteAddr":"xxmyipxx","user":"--","app":"admin_audit","method":"PUT","url":"\/remote.php\/webdav\/InstantUpload\/Conversations%20Images\/899fc1af-e594-4edf-8d34-ed0079bef9fe.jpg","message":"Login attempt: \"xxmyusernamexx\"","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.1","version":"13.0.4.0"}
{"reqId":"eSU01CFbver4tFSE7iWl","level":2,"time":"2018-08-16T06:15:55+00:00","remoteAddr":"xxmyipxx","user":"--","app":"core","method":"PUT","url":"\/remote.php\/webdav\/InstantUpload\/Conversations%20Images\/899fc1af-e594-4edf-8d34-ed0079bef9fe.jpg","message":"Login failed: 'xxmyusernamexx' (Remote IP: 'xxmyipxx')","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.1","version":"13.0.4.0"}
{"reqId":"eSU01CFbver4tFSE7iWl","level":1,"time":"2018-08-16T06:15:55+00:00","remoteAddr":"xxmyipxx","user":"--","app":"core","method":"PUT","url":"\/remote.php\/webdav\/InstantUpload\/Conversations%20Images\/899fc1af-e594-4edf-8d34-ed0079bef9fe.jpg","message":"Bruteforce attempt from \"xxmyipxx\" detected for action \"login\".","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.1","version":"13.0.4.0"}
{"reqId":"eSU01CFbver4tFSE7iWl","level":0,"time":"2018-08-16T06:15:55+00:00","remoteAddr":"xxmyipxx","user":"--","app":"webdav","method":"PUT","url":"\/remote.php\/webdav\/InstantUpload\/Conversations%20Images\/899fc1af-e594-4edf-8d34-ed0079bef9fe.jpg","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Message\":\"Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/var\\\/www\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(80): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/remote.php(164): require_once('\\\/var\\\/www\\\/apps\\\/d...')\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":168}","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.2.1","version":"13.0.4.0"}
tobiasKaminsky commented 6 years ago

@gjedeer this looks like a regular authentication failure. Can you browse the files within the app correctly? Is this happening with a new user?

gjedeer commented 6 years ago

No: after entering the password many, many times i verified it by logging into the web UI and it worked. Also yes, I could browse files for a second or so. The user exists for years, it's also not the only affected user.

@ all affected in this thread: switch to app passwords. It fixed the issue for me. @tobiasKaminsky it's just a workaround, though, the bug is still somewhere out there.

There's also this related thread on nextcloud/server bug tracker: https://github.com/nextcloud/server/issues/8011

tomasbrchan commented 6 years ago

I have similar issue. I grant access to my phone (set server, login, password). I added pin code for fast access. Everything looks ok. After I restart phone I have to fill grant access again, again to fill server, name & password. I tried to clear all data & reinstall app, but it does not help. Note: I have my app on SD card. Can it cause it?

tobiasKaminsky commented 6 years ago

We had a bug with fingerprint (un)lock mechansim. It affected only a few devices, e.g. Xiaomi, Motorola, … As none of our test deices was affected, hunting this bug down took a while.

If any of you could download and install this apk (https://cloud.nextcloud.com/s/pCwRFo7rFF3MMjM) and test if it is now working better, I would appreciate it. (the APK file is signed with the key for Google Play Store and is 3.3.2 Alpha 1, so this proves that it is an official version and can be easily upgraded. The up-to-come 3.3.2 version then can also just update this version).

pjrobertson commented 5 years ago

I am having a similar problem with the Nextcloud app on a Xiaomi Note 7 (OS: MIUI 10.2). The app was previously working no problem, however today when I opened up the app it span for a few seconds then skipped to the login screen. Here's a video of the issue. I'm happy to debug, if you need me to do anything @tobiasKaminsky

Here's a snippet from nextcloud.log on the server:

{"reqId":"XXXX","level":2,"time":"2019-02-17T01:47:05+00:00","remoteAddr":"Y.Y.Y.Y","user":"--","app":"core","method":"GET","url":"\/ocs\/v1.php\/cloud\/capabilities?format=json","message":"Login failed: 'USERNAME' (Remote IP: 'Y.Y.Y.Y')","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.5.0","version":"15.0.4.0"}
{"reqId":"XXXX","level":2,"time":"2019-02-17T01:47:05+00:00","remoteAddr":"Y.Y.Y.Y","user":"--","app":"core","method":"GET","url":"\/index.php\/avatar\/USERNAME\/352","message":"Login failed: 'USERNAME' (Remote IP: 'Y.Y.Y.Y')","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.5.0","version":"15.0.4.0"}
{"reqId":"XXXX","level":2,"time":"2019-02-17T01:47:07+00:00","remoteAddr":"Y.Y.Y.Y","user":"--","app":"core","method":"GET","url":"\/ocs\/v1.php\/cloud\/user?format=json","message":"Login failed: 'USERNAME' (Remote IP: 'Y.Y.Y.Y')","userAgent":"Mozilla\/5.0 (Android) ownCloud-android\/3.5.0","version":"15.0.4.0"}
{"reqId":"XXXX","level":2,"time":"2019-02-17T01:47:13+00:00","remoteAddr":"Y.Y.Y.Y","user":"--","app":"core","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"Login failed: 'USERNAME' (Remote IP: 'Y.Y.Y.Y')","userAgent":"Mozilla\/5.0 (Android) Nextcloud-android\/3.5.0","version":"15.0.4.0"}

And then from adb logcat:

02-17 09:53:47.206 26468 27602 D OwnCloudClient #15: REQUEST GET /ocs/v1.php/cloud/capabilities
02-17 09:53:47.575 26468 27602 D GetRemoteCapabilitiesOperation: Successful response: {"ocs":{"meta":{"status":"ok","statuscode":100,"message":"OK","totalitems":"","itemsperpage":""},"data":{"version":{"major":15,"minor":0,"micro":4,"string":"15.0.4","edition":""},"capabilities":{"bruteforce":{"delay":0},"theming":{"name":"NEXTCLOUD NAME","url":"http:\/\/server.example.com","slogan":"Powering Clean Air Across the Globe","color":"#355199","color-text":"#ffffff","color-element":"#355199","logo":"https:\/\/server.example.com\/index.php\/apps\/theming\/image\/logo?useSvg=1&v=22","background":"https:\/\/server.example.com\/core\/img\/background.png?v=22","background-plain":false,"background-default":true}}}}}
02-17 09:53:47.576 26468 27602 D GetRemoteCapabilitiesOperation: *** Added version
02-17 09:53:47.576 26468 27602 D GetRemoteCapabilitiesOperation: *** Added theming
02-17 09:53:47.577 26468 27602 D GetRemoteCapabilitiesOperation: *** Get Capabilities completed 
02-17 09:53:47.607 26468 27602 D OwnCloudClient #15: REQUEST GET /ocs/v1.php/cloud/user
02-17 09:53:48.068 26468 27602 E GetRemoteUserInfoOperation: Failed response while getting user information 
02-17 09:53:48.069 26468 27602 E GetRemoteUserInfoOperation: *** status code: 401 ; response message: {"ocs":{"meta":{"status":"failure","statuscode":997,"message":"Current user is not logged in","totalitems":"","itemsperpage":""},"data":[]}}
02-17 09:53:48.069 26468 27602 W RefreshFolderOperation: Couldn't update user profile from server
02-17 09:53:48.069 26468 27602 D RefreshFolderOperation: Checking changes in USERNAME@server.example.com/
02-17 09:53:48.086 26468 27602 D OwnCloudClient #15: REQUEST PROPFIND /remote.php/webdav/
02-17 09:53:48.889 26468 27602 I AuthChallengeProcessor: Basic authentication scheme selected
02-17 09:53:48.890 26468 27602 I HttpMethodDirector: Failure authenticating with BASIC 'NEXTCLOUD NAME'@server.example.com:443
02-17 09:53:48.896 26468 27602 E RefreshFolderOperation: Checked USERNAME@server.example.com/ : Operation finished with HTTP status code 401 (fail)
pjrobertson commented 5 years ago

Update: FYI, removing the account and re-adding worked.

drkmccy commented 5 years ago

I think this is the same as #2553 and #3623

labatt24 commented 5 years ago

Just to let you know, I updated Freenas to lastest version with the new "jail" as "iocage" with the updated Nextcloud as plugin. No more issues!

stale[bot] commented 5 years ago

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

drkmccy commented 5 years ago

This shouldn't have been closed.