nextcloud / notes-android

✎ Android client for Nextcloud Notes app.
https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes
GNU General Public License v3.0
946 stars 135 forks source link

Synchronization failed: Token Mismatch Exception #2013

Open Crell opened 9 months ago

Crell commented 9 months ago

Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

Initial sync on my new phone worked 2 months ago, but since then I am unable to sync the app to my Nextcloud server. The server is running fine, and the Nextcloud android app can talk to it, but the Notes app always fails to sync.

To Reproduce

  1. Open the app
  2. See a message at the bottom of the screen "Synchronization failed", with a "more" link.
  3. Click the "more" link, copy the error message and stack trace shown below.

This seems similar to #1914, but it's a different top level error.

Expected behavior

I expect data to sync?

Smartphone (please complete the following information):

Server

Stacktrace

App Version: 4.1.0
App Version Code: 40010090
App Flavor: play

Files App Version Code: 30270090 (PROD)

---

OS Version: 5.15.110-android14-11-gcc48824eebe8-ab10865596(11206848)
OS API Level: 34
Device: husky
Manufacturer: Google
Model (and Product): Pixel 8 Pro (husky)

---
java.lang.RuntimeException: com.nextcloud.android.sso.exceptions.TokenMismatchException: Provided authentication token does not match or package name is not permitted to perform this action
    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:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: com.nextcloud.android.sso.exceptions.TokenMismatchException: Provided authentication token does not match or package name is not permitted to perform this action
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:197)
    at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:180)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:122)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.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
cryptogeek13 commented 7 months ago

Same problem for me:

Smartphone (please complete the following information):

Nextcloud Notes-Version (android app): 4.2.0
F-Droid or Play Store: F-Droid
Android-Version: 11
Device: Huawei P20 Pro

Server

Nextcloud version: 27.1.7
Nextcloud Notes version (server app): 4.9.4
cryptogeek13 commented 7 months ago

Workaround: Deleting app data fixed the issue for me.

Crell commented 7 months ago

@cryptogeek13 That would delete all on-device notes as well, wouldn't it? It then successfully resyncs from the server?

stefan-niedermann commented 7 months ago

That would delete all on-device notes as well,

It behaves as explained in the FAQ you commited to read when opening the issue.

KaiRo-at commented 7 months ago

That would delete all on-device notes as well,

It behaves as explained in the FAQ you commited to read when opening the issue.

Yes, but throwing away all your unsynchronized notes to get rid of the login data is not just a major hassle (yes, losing important unsaved data, exactly one reason why I use DON'T use an app that keeps notes just locally) but also feels like exterminating a whole city to get rid of some rats in one part the underground wastewater system.

bgravato commented 3 months ago

Same problem here... it stopped syncing long ago... I always it would fix itself up eventually after some upgrade or some other solution, but it didn't...

Now I have a bunch of notes on my phone only that I can't sync and deleting/re-adding my account/data would make me lose those notes... It's even worse considering there's no other way of saving these notes except copying the text in them one by one to another app or text file, which is a real PITA (especially in a phone).

There should be a way of deleting/resetting the authentication token without having to delete the account and losing all unsaved data...

splintering commented 2 weeks ago

Kssue still occurs with Nextcloud 30.0.1 / Noted 4.11.0 on the following mobile environment:

App Version: 4.3.1 App Version Code: 40030190 App Flavor: fdroid

Files App Version Code: 30300390 (PROD)


OS Version: 5.15.123-android13-3-28579584(A546BXXSACXI3) OS API Level: 34 Device: a54x Manufacturer: samsung Model (and Product): SM-A546B (a54xnaeea)

Removing the account did not help, App data had to be cleared.

It seems the Notes App pulls the auth info from the Nextcloud app. Maybe the issue occurred because I replaced the fdroid version of the Nextcloud app with the GitHub version to circumvent a bug and then switched back to the fdroid version once the bugfix was pushed there...

sol8712 commented 2 days ago

Kssue still occurs with Nextcloud 30.0.1 / Noted 4.11.0 on the following mobile environment:

App Version: 4.3.1 App Version Code: 40030190 App Flavor: fdroid

Files App Version Code: 30300390 (PROD)

OS Version: 5.15.123-android13-3-28579584(A546BXXSACXI3) OS API Level: 34 Device: a54x Manufacturer: samsung Model (and Product): SM-A546B (a54xnaeea)

Removing the account did not help, App data had to be cleared.

It seems the Notes App pulls the auth info from the Nextcloud app. Maybe the issue occurred because I replaced the fdroid version of the Nextcloud app with the GitHub version to circumvent a bug and then switched back to the fdroid version once the bugfix was pushed there...

I too just came across this issue.

3 or 4 days ago i switched my NC app from an older version to one with a different signing key, like you would have when switching from fdroid to play store to github versions, this may be the issue. Ill try to test this later today. Maybe not a bug, but its somthing that should be handled in a more user friendly manner