React Native Cookies

Cookie manager for React Native
Alternatives To React Native Cookies
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Next Auth18,815212268 hours ago650July 25, 2023300iscTypeScript
Authentication for the Web.
Javascript Interview Questions17,945
a day ago1JavaScript
List of 1000 JavaScript Interview Questions
Nookies2,124511232 days ago34January 21, 202127TypeScript
🍪 A set of cookie helpers for Next.js
Klaro Js1,058625 days ago73April 07, 2021123otherJavaScript
Klaro! A privacy and security tool for your website.
3 days ago134mit
A tech blog about Front-end, JavaScript and Security
React Native Cookies783
4 years ago85mitObjective-C
Cookie manager for React Native
4 years ago41JavaScript
6 years ago32apache-2.0Erlang
Tool for developers working with systems running on the Erlang VM (BEAM). It helps with performance analysis.
React Cookie Consent51652354 months ago80July 31, 20221mitTypeScript
A small, simple and customizable cookie consent bar for use in React applications.
React Native Login430
7 years ago2JavaScript
:iphone: An example React Native project for client login authentication
Alternatives To React Native Cookies
Select To Compare

Alternative Project Comparisons


Cookie manager for react native.

npm version npm downloads GitHub license

This project has moved

This project has been moved to the React Native Community.


yarn add react-native-cookies


Automatic (recommended)

react-native link react-native-cookies


If automatic linking does not work, you can manually link this library by following the instructions below:

  1. Open your project in Xcode, right click on Libraries and click Add Files to "Your Project Name" Look under node_modules/react-native-cookies/ios and add RNCookieManagerIOS.xcodeproj.
  2. Add libRNCookieManagerIOS.a to `Build Phases -> Link Binary With Libraries.
  3. Clean and rebuild your project

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:


include ':react-native-cookies'
project(':react-native-cookies').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cookies/android')


dependencies {
   compile project(':react-native-cookies')

On top, where imports are:

import com.psykar.cookiemanager.CookieManagerPackage;

Add the CookieManagerPackage class to your list of exported packages.

protected List<ReactPackage> getPackages() {
    return Arrays.asList(
            new MainReactPackage(),
            new CookieManagerPackage()


import CookieManager from 'react-native-cookies';

// set a cookie (IOS ONLY)
  name: 'myCookie',
  value: 'myValue',
  domain: 'some domain',
  origin: 'some origin',
  path: '/',
  version: '1',
  expiration: '2015-05-30T12:30:00.00-05:00'
}).then((res) => {
  console.log('CookieManager.set =>', res);

// Set cookies from a response header
// This allows you to put the full string provided by a server's Set-Cookie 
// response header directly into the cookie store.
  'user_session=abcdefg; path=/; expires=Thu, 1 Jan 2030 00:00:00 -0000; secure; HttpOnly')
    .then((res) => {
      // `res` will be true or false depending on success.
      console.log('CookieManager.setFromResponse =>', res);

// Get cookies as a request header string
  .then((res) => {
    console.log('CookieManager.get =>', res); // => 'user_session=abcdefg; path=/;'

// list cookies (IOS ONLY)
  .then((res) => {
    console.log('CookieManager.getAll =>', res);

// clear cookies
  .then((res) => {
    console.log('CookieManager.clearAll =>', res);

// clear a specific cookie by its name (IOS ONLY)
  .then((res) => {
    console.log('CookieManager.clearByName =>', res);

WebKit-Support (iOS only)

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)
import CookieManager from 'react-native-cookies';

const useWebKit = true;

// list cookies (IOS ONLY)
	.then((res) => {
		console.log('CookieManager.getAll from webkit-view =>', res);

// clear cookies
	.then((res) => {
		console.log('CookieManager.clearAll from webkit-view =>', res);

// Get cookies as a request header string
CookieManager.get('', useWebKit)
	.then((res) => {
		console.log('CookieManager.get from webkit-view =>', res);
		// => 'user_session=abcdefg; path=/;'

// set a cookie (IOS ONLY)
const newCookie: = {
	name: 'myCookie',
	value: 'myValue',
	domain: 'some domain',
	origin: 'some origin',
	path: '/',
	version: '1',
	expiration: '2015-05-30T12:30:00.00-05:00'

CookieManager.set(newCookie, useWebKit)
	.then((res) => {
		console.log('CookieManager.set from webkit-view =>', res);


  • Proper getAll dictionary by domain
  • Proper error handling
  • Anything else?

PR's welcome!

Popular Cookie Projects
Popular Reactjs Projects
Popular Networking Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Objective C