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

Synchronization failed: `TokenMismatchException`

Open Crell opened this issue 1 year ago • 12 comments

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):

  • Nextcloud Notes-Version (android app): 4.1.0
  • F-Droid or Play Store: Play store
  • Android-Version: 14 (last updated 5 January 2024)
  • Device: Pixel 8 Pro

Server

  • Nextcloud version: 27.1.5
  • Nextcloud Notes version (server app): 4.9.2

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

Crell avatar Feb 11 '24 18:02 Crell

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

proud-nerd avatar Apr 14 '24 09:04 proud-nerd

Workaround: Deleting app data fixed the issue for me.

proud-nerd avatar Apr 14 '24 09:04 proud-nerd

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

Crell avatar Apr 14 '24 18:04 Crell

That would delete all on-device notes as well,

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

stefan-niedermann avatar Apr 14 '24 18:04 stefan-niedermann

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.

KaiRo-at avatar Apr 19 '24 14:04 KaiRo-at

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...

bgravato avatar Aug 13 '24 11:08 bgravato