nextcloud / nextcloud/notes-android
Synchronization failed: `TokenMismatchException`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 168
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 31
Description
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
- Open the app
- See a message at the bottom of the screen "Synchronization failed", with a "more" link.
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at NotesServerSyncTask.pullRemoteChanges in NotesServerSyncTask.java:219 and follow the sync path from run at line 96. Reproduce the initial sync on the listed Android and Nextcloud versions, then determine why the SSO request receives TokenMismatchException; done means synchronization completes without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- authentication, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100