Gathering detailed insights and metrics for @react-native-community/react-native-cookies
Gathering detailed insights and metrics for @react-native-community/react-native-cookies
Gathering detailed insights and metrics for @react-native-community/react-native-cookies
Gathering detailed insights and metrics for @react-native-community/react-native-cookies
🍪 Cookie Manager for React Native
npm install @react-native-community/react-native-cookies
Typescript
Module System
Node Version
NPM Version
Java (47.79%)
Objective-C (43.84%)
JavaScript (6.07%)
Ruby (2.3%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
508 Stars
116 Commits
101 Forks
5 Watchers
9 Branches
25 Contributors
Updated on Jul 10, 2025
Latest Version
1.1.1
Package Id
@react-native-community/react-native-cookies@1.1.1
Unpacked Size
100.59 kB
Size
62.75 kB
File Count
18
NPM Version
6.13.6
Node Version
8.17.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Cookie Manager for React Native
This module was ported from joeferraro/react-native-cookies. This would not exist without the work of the original author, Joe Ferraro.
Currently lacking support for Windows, Web, and Expo. Support for these platforms will be created when there is a need for them. Starts with a posted issue.
yarn add @react-native-community/react-native-cookies
react-native link @react-native-community/react-native-cookies
If automatic linking does not work, you can manually link this library by following the instructions below:
Libraries
and click Add Files to "Your Project Name"
Look under node_modules/@react-native-community/react-native-cookies/ios
and add RNCookieManagerIOS.xcodeproj
.libRNCookieManagerIOS.a
to `Build Phases -> Link Binary With Libraries.Run react-native link
to link the react-native-cookies library.
Or if you have trouble, make the following additions to the given files manually:
android/settings.gradle
1include ':@react-native-community_react-native-cookies' 2project(':@react-native-community_react-native-cookies').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/react-native-cookies/android')
android/app/build.gradle
1dependencies { 2 ... 3 implementation project(':@react-native-community_react-native-cookies') 4}
MainApplication.java
On top, where imports are:
1import com.reactnativecommunity.cookies.CookieManagerPackage;
Add the CookieManagerPackage
class to your list of exported packages.
1@Override 2protected List<ReactPackage> getPackages() { 3 return Arrays.asList( 4 new MainReactPackage(), 5 new CookieManagerPackage() 6 ); 7}
1import CookieManager from '@react-native-community/react-native-cookies'; 2 3// set a cookie (IOS ONLY) 4CookieManager.set({ 5 name: 'myCookie', 6 value: 'myValue', 7 domain: 'some domain', 8 origin: 'some origin', 9 path: '/', 10 version: '1', 11 expiration: '2015-05-30T12:30:00.00-05:00' 12}).then((res) => { 13 console.log('CookieManager.set =>', res); 14}); 15 16// Set cookies from a response header 17// This allows you to put the full string provided by a server's Set-Cookie 18// response header directly into the cookie store. 19CookieManager.setFromResponse( 20 'http://example.com', 21 'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly') 22 .then((res) => { 23 // `res` will be true or false depending on success. 24 console.log('CookieManager.setFromResponse =>', res); 25 }); 26 27// Get cookies as a request header string 28CookieManager.get('http://example.com') 29 .then((res) => { 30 console.log('CookieManager.get =>', res); // => 'user_session=abcdefg; path=/;' 31 }); 32 33// list cookies (IOS ONLY) 34// useWebKit: boolean 35CookieManager.getAll(useWebKit) 36 .then((res) => { 37 console.log('CookieManager.getAll =>', res); 38 }); 39 40// clear cookies 41CookieManager.clearAll() 42 .then((res) => { 43 console.log('CookieManager.clearAll =>', res); 44 }); 45 46// clear a specific cookie by its name (IOS ONLY) 47CookieManager.clearByName('cookie_name') 48 .then((res) => { 49 console.log('CookieManager.clearByName =>', res); 50 }); 51
React Native comes with a WebView component, which uses UIWebView on iOS. Introduced in iOS 8 Apple implemented the WebKit-Support with all the performance boost.
To use this it's required to use a special implementation of the WebView component (e.g. react-native-wkwebview).
This special implementation of the WebView component stores the cookies not in NSHTTPCookieStorage
anymore. The new cookie-storage is WKHTTPCookieStore
and implementes a differnt interface.
To use this CookieManager with WebKit-Support we extended the interface with the attribute useWebKit
(a boolean value, default: FASLE
) for the following methods:
Method | WebKit-Support | Method-Signature |
---|---|---|
getAll | Yes | CookieManager.getAll(useWebKit:boolean) |
clearAll | Yes | CookieManager.clearAll(useWebKit:boolean) |
get | Yes | CookieManager.get(url:string, useWebKit:boolean) |
set | Yes | CookieManager.set(cookie:object, useWebKit:boolean) |
1import CookieManager from '@react-native-community/react-native-cookies'; 2 3const useWebKit = true; 4 5// list cookies (IOS ONLY) 6CookieManager.getAll(useWebKit) 7 .then((res) => { 8 console.log('CookieManager.getAll from webkit-view =>', res); 9 }); 10 11// clear cookies 12CookieManager.clearAll(useWebKit) 13 .then((res) => { 14 console.log('CookieManager.clearAll from webkit-view =>', res); 15 }); 16 17// Get cookies as a request header string 18CookieManager.get('http://example.com', useWebKit) 19 .then((res) => { 20 console.log('CookieManager.get from webkit-view =>', res); 21 // => 'user_session=abcdefg; path=/;' 22 }); 23 24// set a cookie (IOS ONLY) 25const newCookie: = { 26 name: 'myCookie', 27 value: 'myValue', 28 domain: 'some domain', 29 origin: 'some origin', 30 path: '/', 31 version: '1', 32 expiration: '2015-05-30T12:30:00.00-05:00' 33}; 34 35CookieManager.set(newCookie, useWebKit) 36 .then((res) => { 37 console.log('CookieManager.set from webkit-view =>', res); 38 });
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 9/21 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More