From 76274033db4f753894f88833c55692725f101d2d Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Sat, 18 Jan 2025 04:35:22 -0800 Subject: [PATCH] Android: Fixes #11292: Fix unable to sync with multiple Nextcloud accounts in different profiles (#11674) --- packages/lib/WebDavApi.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/lib/WebDavApi.js b/packages/lib/WebDavApi.js index 7bc9cd5cfb..930e5d38c2 100644 --- a/packages/lib/WebDavApi.js +++ b/packages/lib/WebDavApi.js @@ -378,6 +378,15 @@ class WebDavApi { if (options.path) fetchOptions.path = options.path; if (body) fetchOptions.body = body; fetchOptions.ignoreTlsErrors = this.options_.ignoreTlsErrors(); + if (shim.mobilePlatform() === 'android') { + // Using credentials = 'omit' prevents authentication cookies from + // being stored. React Native has issues related to cookie authentication: + // https://github.com/facebook/react-native/issues/23185 + // + // Auth tokens are passed through the "Authorization" header, so + // these cookies should not be necessary. + fetchOptions.credentials = 'omit'; + } const url = `${this.baseUrl()}/${ltrimSlashes(path)}`; if (shim.httpAgent(url)) fetchOptions.agent = shim.httpAgent(url);