Nextcloud sync fails on all but the default profile

I suspect there's some bug in how Joplin handles cookies on Android. I am seeing issues even without 2 profiles like this:

  1. start with a clean state
  2. enter nextcloud details and press "Check Synchronization Configuration"
  3. now without leaving the screen change the details to another user on the same server
  4. check configuration succeeds but when you try to actually sync NC returns "permission denied"

I think some cookie specific to a particular nextcloud account gets saved on step 2 and then incorrectly used for all subsequent steps for a different account.