Skip to content

Commit ab33361

Browse files
Android: May fix laurent22#11292: Don't store WebDAV authentication cookies on Android
Note: An alternative, as suggested on the linked issue, might be to allow users to manually delete all cookies (e.g. under advanced settings). This, however, is more complicated (may require either Android-specific native code or adding a library).
1 parent 40914be commit ab33361

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/lib/WebDavApi.js

+9
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,15 @@ class WebDavApi {
378378
if (options.path) fetchOptions.path = options.path;
379379
if (body) fetchOptions.body = body;
380380
fetchOptions.ignoreTlsErrors = this.options_.ignoreTlsErrors();
381+
if (shim.mobilePlatform() === 'android') {
382+
// Using credentials = 'omit' prevents authentication cookies from
383+
// being stored. React Native has issues related to cookie authentication:
384+
// https://github.com/facebook/react-native/issues/23185
385+
//
386+
// Auth tokens are passed through the "Authorization" header, so
387+
// these cookies should not be necessary.
388+
fetchOptions.credentials = 'omit';
389+
}
381390
const url = `${this.baseUrl()}/${ltrimSlashes(path)}`;
382391

383392
if (shim.httpAgent(url)) fetchOptions.agent = shim.httpAgent(url);

0 commit comments

Comments
 (0)