Skip to content

Mobile: Fix Joplin Cloud login failing when Android kills the app during OAuth#15111

Open
laurent22 wants to merge 1 commit intodevfrom
mobile_oauth_login_fix
Open

Mobile: Fix Joplin Cloud login failing when Android kills the app during OAuth#15111
laurent22 wants to merge 1 commit intodevfrom
mobile_oauth_login_fix

Conversation

@laurent22
Copy link
Copy Markdown
Owner

@laurent22 laurent22 commented Apr 15, 2026

Fixed an issue where the Joplin Cloud login would fail on Android if the system killed the app while the user was authorising in the browser.

The app now saves the authentication request before opening the browser and, on next startup, checks if the authorisation was completed on the server. Previously, the credentials were lost when the app was killed, requiring the user to re-authorise repeatedly.

Possible fix for https://discourse.joplinapp.org/t/joplin-cloud-credentials-are-invalid-cant-sync-android-app-with-windows/49610/5

TODO

  • Needs to be tested properly on all platforms

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a mechanism to persist and recover pending Joplin Cloud authentication by storing an application auth ID in settings and completing the authentication flow during application startup on both desktop and mobile platforms.

Changes

Cohort / File(s) Summary
Application Startup Integration
packages/app-desktop/app.ts, packages/app-mobile/utils/buildStartupTasks.ts
Added new startup tasks that invoke completePendingAuthentication() to handle recovery of interrupted Joplin Cloud authentication flows on application launch.
Login Screen Updates
packages/app-desktop/gui/JoplinCloudLoginScreen.tsx, packages/app-mobile/components/screens/JoplinCloudLoginScreen.tsx
Updated login screens to call saveApplicationAuthId() when users initiate authorization, persisting the generated auth identifier for recovery purposes.
Core Authentication Services
packages/lib/services/joplinCloudUtils.ts, packages/lib/models/settings/builtInMetadata.ts
Added new setting sync.10.pendingAuthId to store pending authentication state, introduced saveApplicationAuthId() and completePendingAuthentication() functions, and updated checkIfLoginWasSuccessful() to clear the pending auth ID upon successful completion.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Pr Description Must Follow Guidelines ❌ Error Pull request lacks required Test Plan section detailing manual testing on Android, automated test cases, and verification steps as mandated by technical_spec.md guidelines. Add Test Plan section documenting manual OAuth flow testing on Android, automated test coverage for saveApplicationAuthId() and completePendingAuthentication() functions, and reviewer verification steps.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing Joplin Cloud login on Android when the OS kills the app during OAuth authentication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description accurately relates to the changeset, explaining the issue (Joplin Cloud login failure when Android kills the app during OAuth), the solution (saving authentication request before browser opening), and the impact (checking on startup if authorisation completed).
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mobile_oauth_login_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added bug It's a bug mobile All mobile platforms desktop All desktop platforms sync sync related issue labels Apr 15, 2026
@laurent22 laurent22 added the v3.7 label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug It's a bug desktop All desktop platforms mobile All mobile platforms sync sync related issue v3.7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant