notes-android icon indicating copy to clipboard operation
notes-android copied to clipboard

`HTTP 401` (reauthenticate by Nextcloud Android app was possible): `NextcloudHttpRequestFailedException`

Open SamWhited opened this issue 3 years ago • 1 comments

Describe the bug

After using notes for a time, it began failing to synchronize. The error is something about auth and CORS, but I do not see a way to re-authenticate without erasing the account and starting over (which I don't want to do because notes aren't syncronized).

To Reproduce

I am unsure how to reproduce the issue.

Expected behavior

Notes sync.

Smartphone (please complete the following information):

  • Nextcloud Notes-Version (android app): 3.5.00
  • F-Droid or Play Store: F-droid
  • Android-Version: LineageOS Nightly (May 27th)
  • Device: Asus Zenphone 8

Server

  • Nextcloud version: Unknown
  • Nextcloud Notes version (server app): Unknown

(I am not the administrator of the instance and see no way to get this information from the app; if there's an easy way to find this please advise)

Stacktrace

App Version: 3.5.00
App Version Code: 3005000
App Flavor: fdroid

Files App Version Code: 30200190

---

OS Version: 5.4.161-qgki-perf-gc654c7a3ab52(408cf67e3f)
OS API Level: 32
Device: ASUS_I006D
Manufacturer: asus
Model (and Product): ASUS_I006D (WW_I006D)

---

java.lang.Exception: {"message":"CORS requires basic auth"}

at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:174)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)


java.lang.RuntimeException: com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 401
at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:93)
at io.reactivex.Maybe.blockingGet(Maybe.java:2321)
at io.reactivex.Observable.blockingSingle(Observable.java:5381)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pullRemoteChanges(NotesServerSyncTask.java:219)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:96)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
Caused by: com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 401
at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:188)
at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:199)
at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:129)
at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda2.subscribe(Unknown Source:6)
at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
at io.reactivex.Maybe.subscribe(Maybe.java:4290)
at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
... 8 more
Caused by: java.lang.IllegalStateException: {"message":"CORS requires basic auth"}

at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:455)
at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:128)
at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:111)
at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:158)
at android.os.Binder.execTransactInternal(Binder.java:1179)
at android.os.Binder.execTransact(Binder.java:1143)

SamWhited avatar May 31 '22 12:05 SamWhited

Update: I just used the main nextcloud app and it asked me to re-auth. After revoking and re-creating the app password the notes app started working too. I suppose this is just a UX bug: I'd expect it to just forward me to the main app's auth screen or mention that I should go back to the main app and auth if that's what was required instead of showing a stack trace. Thanks for building this great app!

SamWhited avatar May 31 '22 13:05 SamWhited