nextcloud / android

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

Wrong username or password after temporary auth backend unavailability #10761

Open jficz opened 2 years ago

jficz commented 2 years ago

⚠️ Before posting ⚠️

Steps to reproduce

  1. have users_external enabled with IMAP backend
  2. have a user authenticated by this backend
  3. have NC app with that user's creds logged in (via QR code)
  4. turn off IMAP backend for a few minutes
  5. app says "Wrong username or password"
  6. turn the backend back on
  7. app still says "Wrong username or password"

Expected behaviour

App should stop nagging about wrong username and password and just work as it did before since nothing changed. Other apps not using the NC account provided by NC app don't have this issue (Talk, browser extensions, etc) but apps using the NC-provided account fail to connect, too.

Actual behaviour

Instead of restoring to working condition transparently the app remains convinced that the stored credentials are wrong and forces a new login, i.e. the login screen is displayed no matter what I try to do, including force-close and phone reboot.

I have to find a computer, log in through a browser and generate a new app token/QR code unnecessarily.

Android version

10

Device brand and model

SM-G960F (Samsung S9)

Stock or custom OS?

Custom (explain in "additional information")

Nextcloud android app version

3.20.3

Nextcloud server version

24.0.4

Using a reverse proxy?

Yes

Android logs

09-23 15:38:33.270 23315   867 V com.nextcloud.android.sso.api.AidlNetworkRequest: [waitForApi] - api not ready yet.. waiting [AsyncTask #102]
09-23 15:38:33.271 23315   868 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] connectApiWithBackoff() called from Thread: [Thread-434]
09-23 15:38:33.271 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] trying to connect..
09-23 15:38:33.271 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Binding to AccountManagerService for type [nextcloud]
09-23 15:38:33.271 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connect] connect() called [main] Account-Type: [nextcloud]
09-23 15:38:33.271 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Component name is: [com.nextcloud.client]
09-23 15:38:33.273 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Bound to AccountManagerService successfully
09-23 15:38:33.273 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [onServiceConnected] called from Thread: [main] with IBinder [ComponentInfo{com.nextcloud.client/com.owncloud.android.services.AccountManagerService}]: android.os.BinderProxy@940d217
09-23 15:38:33.274 23315   869 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
09-23 15:38:33.300 28087   870 I com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: releaseConnection
09-23 15:38:33.392 19958   879 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.validateToken(InputStreamBinder.java:471)
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.isValid(InputStreamBinder.java:466)
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:402)
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:128)
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:111)
  09-23 15:38:33.393 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:158)
09-23 15:38:33.400 28087   895 E com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: writing failed: write failed: EPIPE (Broken pipe)
09-23 15:38:33.411 19958   902 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.validateToken(InputStreamBinder.java:471)
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.isValid(InputStreamBinder.java:466)
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:402)
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:128)
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:111)
  09-23 15:38:33.412 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:158)
09-23 15:38:33.416 28087   904 E com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: writing failed: write failed: EPIPE (Broken pipe)
09-23 15:38:33.428 19958   912 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.validateToken(InputStreamBinder.java:471)
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.isValid(InputStreamBinder.java:466)
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:402)
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:128)
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:111)
  09-23 15:38:33.429 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:158)
09-23 15:38:33.433 28087   915 E com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: writing failed: write failed: EPIPE (Broken pipe)
09-23 15:38:33.442 19958   921 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.validateToken(InputStreamBinder.java:471)
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.isValid(InputStreamBinder.java:466)
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:402)
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:128)
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:111)
  09-23 15:38:33.444 28087 28247 E InputStreamBinder: at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:158)
09-23 15:38:33.457 28087   926 I com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: releaseConnection
09-23 15:38:33.460 28087   922 E com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: writing failed: write failed: EPIPE (Broken pipe)
09-23 15:38:33.461 23315 28859 V com.nextcloud.android.sso.api.AidlNetworkRequest: [waitForApi] - api not ready yet.. waiting [AsyncTask #96]
09-23 15:38:33.464 23315   927 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] connectApiWithBackoff() called from Thread: [Thread-435]
09-23 15:38:33.464 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] trying to connect..
09-23 15:38:33.464 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Binding to AccountManagerService for type [nextcloud]
09-23 15:38:33.464 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connect] connect() called [main] Account-Type: [nextcloud]
09-23 15:38:33.464 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Component name is: [com.nextcloud.client]
09-23 15:38:33.470 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Bound to AccountManagerService successfully
09-23 15:38:33.470 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [onServiceConnected] called from Thread: [main] with IBinder [ComponentInfo{com.nextcloud.client/com.owncloud.android.services.AccountManagerService}]: android.os.BinderProxy@940d217
09-23 15:38:33.477 23315   935 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
09-23 15:38:33.735 28087  1007 I com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread: releaseConnection
09-23 15:38:38.180 23315  1049 V com.nextcloud.android.sso.api.AidlNetworkRequest: [waitForApi] - api not ready yet.. waiting [IntentService[WebTrackService]]
09-23 15:38:38.180 23315  1050 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] connectApiWithBackoff() called from Thread: [Thread-436]
09-23 15:38:38.180 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connectApiWithBackoff] trying to connect..
09-23 15:38:38.180 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Binding to AccountManagerService for type [nextcloud]
09-23 15:38:38.180 23315 23315 D com.nextcloud.android.sso.api.NetworkRequest: [connect] connect() called [main] Account-Type: [nextcloud]
09-23 15:38:38.180 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Component name is: [com.nextcloud.client]
09-23 15:38:38.182 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [connect] Bound to AccountManagerService successfully
09-23 15:38:38.182 23315 23315 D com.nextcloud.android.sso.api.AidlNetworkRequest: [onServiceConnected] called from Thread: [main] with IBinder [ComponentInfo{com.nextcloud.client/com.owncloud.android.services.AccountManagerService}]: android.os.BinderProxy@940d217
09-23 15:38:38.184 23315  1051 D com.nextcloud.android.sso.api.AidlNetworkRequest: copy data from service finished
  09-23 15:38:38.822 28087 28248 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.processRequest(InputStreamBinder.java:387)
  09-23 15:38:38.822 28087 28248 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStream(InputStreamBinder.java:172)
  09-23 15:38:38.822 28087 28248 E InputStreamBinder: at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequest(InputStreamBinder.java:149)
  09-23 15:38:38.822 28087 28248 E InputStreamBinder: at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:109)

Server error logs

n/a

Additional information

LineageOS, custom built

liquidat commented 21 hours ago

I have the exact same problem with the same setup:

The odd thing is that other users with the same backend and the same nextcloud app are not affected. My hypothesis is that this only affects clients which happened to try to authenticate the moment the imap server was down.

Nextcloud server logs:

{"reqId":"GOy3SQVGJdYYmziNtvgp","level":2,"time":"2024-11-14T17:26:13+00:00","remoteAddr":"A.B.C.D","user":"--","app":"core","method":"PUT","url":"/remote.php/dav/files/someuser/auto-upload/Camera/2024/11/20241114_085109.jpg","message":"Login failed: 'someuser' (Remote IP: 'A.B.C.D')","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.29.2","version":"29.0.8.1","data":{"app":"core"}}

IMAP log:

front-1      | Nov 14 17:25:55 imap-login: Info: Disconnected: Connection closed (auth failed, 1 attempts in 2 secs): user=<someuser@bayz.de>, method=PLAIN, rip=195.201.8.61, rport=48722, lip=172.18.0.2, lport=993, TLS: Connection closed
admin-1      | [2024-11-14 17:25:55 +0000] [19] [DEBUG] GET /internal/auth/email
admin-1      | [2024-11-14 17:25:55,252] INFO in nginx: Login attempt for: someuser@bayz.de/imap/993 from: 195.201.8.61/48736: failed: badauth: AABBCC