.get(url) with `useWebKit: true` in iOS does not return exact match domain cookie
See original GitHub issueBug
CookieManager.get('https://google.com', true)
returns cookies of domain with leading dot(e.g. .google.com
), but not the ones with exact match domain (e.g. google.com
). This issue only happens in iOS with Webkit option on. Both cookies appear no problem if I call getAll(true)
.
Environment info
React native info output:
System:
OS: macOS 10.15.2
CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Memory: 222.88 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.13.0 - /usr/local/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 21, 24, 25, 26, 27, 28, 29
Build Tools: 25.0.3, 26.0.0, 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3, 29.0.2
System Images: android-26 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
Android NDK: 20.1.5948944
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
Library version: 1.1.0
Steps To Reproduce
Make sure you use iOS to test:
- Populate cookie store with cookies having both leading dot and exact match domain, say
google.com
and.google.com
. - Call
CookieManager.getAll(true)
, observe both cookies exists in store - Call
CookieManager.get('https://google.com', true)
, only the cookie with leading dot (.google.com
) is returned, not the one with exact match (‘google.com’). …
Describe what you expected to happen:
- Both cookies should be matched and returned when I call
get(url)
Reproducible sample code
// ios sample code
/* set exact match domain */
await CookieManager.set({
name: 'foo',
value: 'foo',
domain: 'google.com',
origin: 'google.com',
path: '/',
version: '1',
expiration: '2021-05-30T12:30:00.00-05:00',
})
/* set leading dot domain */
await CookieManager.set({
name: 'bar',
value: 'bar',
domain: '.google.com',
origin: 'google.com',
path: '/',
version: '1',
expiration: '2021-05-30T12:30:00.00-05:00',
})
console.log(await CookieManager.getAll(true)) // foo, bar both exists
const test = await CookieManager.get('https://google.com', true)
console.log(test) // only bar shows up
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
.get(url) with `useWebKit: true` in iOS does not return exact ...
Populate cookie store with cookies having both leading dot and exact match domain, say google.com and .google.com . Call CookieManager.getAll( ...
Read more >WKWebView setting Cookie not possible (iOS 11+)
If the domain or the path doesn't match the request, the cookie won't be sent. You can add the cookies explicitly. let url...
Read more >Browser detection using the user agent - HTTP - MDN Web Docs
Start by trying to identify why you want to do it. Are you trying to work around a specific bug in some version...
Read more >WebView - React Native
Boolean that controls whether the web content is scaled to fit the view and enables the user to change the scale. The default...
Read more >Private client-side-only PWAs are hard, but now Apple made ...
As it is you can't really count on browser local storage alone for long-term storage; the same is actually true for Android and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cool thanks for the clarification. I’ll check this out sometime this week.
🎉 This issue has been resolved in version 2.0.3 🎉
The release is available on:
Your semantic-release bot 📦🚀