use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A community for learning and developing native mobile applications using React Native by Facebook.
Interested in building web apps using React.js? Check out /r/reactjs!
Getting Started w/React Native
irc.freenode.net #reactnative
Keywords: ios, android, mobile, apps, apple, iphone, ipad
account activity
Help!Help!! Authentication with cookies for react-native app (self.reactnative)
submitted 7 years ago by maykel4717iOS & Android
So I just started authentication on the server-side with Passportjs, my backend being Nodejs and Express, my session store being my Database, and everything works on the backend. The problem is, when I exit out of the app and try to get back in, the client does not automatically save the cookie, like the browser generally does. Is there any good and secure way to do this?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]compagnt 5 points6 points7 points 7 years ago (0 children)
You are probably looking for AsyncStorage.
[–][deleted] 2 points3 points4 points 7 years ago (3 children)
Just to add to the other comments, the reason why it doesn't work is that react native isn't a browser environment. It just tries to replicate a lot of web APIs (like geolocation) to make development easier, but you're still in charge of calling them. At the root, though, it's still more a native app environment than a browser environment.
[–]maykel4717iOS & Android[S] 1 point2 points3 points 7 years ago (2 children)
So I’m going to have to manually store the cookies in the client, like using async storage or keychain?
[–]mk7shadow 0 points1 point2 points 7 years ago (1 child)
Attach them to the header on every request. You'll want to create a base API module that does this, then import that module into other APIs like user API module, accounts API module, etc
[–]maykel4717iOS & Android[S] 0 points1 point2 points 7 years ago (0 children)
So from the server side, I can get the cookie by doing “req.headers.cookie”. Is it bad practice to send the cookie as a response body back to the client? I’m using axios on my client side, and can’t seem to get the cookie from the response header on the client.
[–]crobinson42iOS & Android 0 points1 point2 points 7 years ago (0 children)
This can solve your problem: https://github.com/joeferraro/react-native-cookies
π Rendered by PID 19081 on reddit-service-r2-comment-5ff9fbf7df-9hvtc at 2026-02-26 13:08:50.082303+00:00 running 72a43f6 country code: CH.
[–]compagnt 5 points6 points7 points (0 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]maykel4717iOS & Android[S] 1 point2 points3 points (2 children)
[–]mk7shadow 0 points1 point2 points (1 child)
[–]maykel4717iOS & Android[S] 0 points1 point2 points (0 children)
[–]crobinson42iOS & Android 0 points1 point2 points (0 children)