Questions tagged [react-cookie]

72 questions
0
votes
1 answer

React Cookie doesn't work with async response

Hello I am working on a React application (an e-commerce). I noticed that when I try loading all the product on a first render, it takes about 9 seconds (Load time is similar to what I got on Postman as well). However, I am trying to improve the…
0
votes
2 answers

Cookies not sent with cross-origin-request

After days of searching and trying, I'm here now. I deployed the React Application in Netlify and the Node.js backend in Heroku. Everything works fine in localhost environment. But after deploying, cookies are not sent in request…
0
votes
2 answers

How can I do async-await operations in sequential order?

I want to save the token in the cookie and run the navigation ("/"). In "/", it is implemented so that the token value is implemented. Therefore, I want to use setCookie to run navigate after the token value comes in. I think we should use async…
김유경
  • 59
  • 1
  • 5
0
votes
1 answer

Set a cookie in react to true all the time

I want to set a cookie to be on true all the time, not when something is happening or something is clicked. So there are several tutorials and articles about that. In my case it should be something like: 'mySpecialCookie = true'. Installing the…
Jean Pierre
  • 281
  • 8
  • 21
0
votes
1 answer

React universal-cookie Some cookies are misusing the recommended “SameSite“ attribute

I'm getting "Some cookies are misusing the recommended “SameSite“ attribute " warning when trying to set a cookie on Firefox. Already added "secure=true" in the code but that did not work. I'm using the "universal-cookie" library Here is the…
akyayik
  • 664
  • 1
  • 8
  • 25
0
votes
1 answer

Problem in create, update and delete Cookie using react-cookie

I am creating a cookie by using react babel but I am facing a problem. When I create a cookie the cookie created in the browser but when I click on the URL to authenticate then the cookies remove from the browser, and when I create it again, the two…
Nischal Tyagi
  • 199
  • 1
  • 10
0
votes
1 answer

How can I set httpOnly enabled cookie in react js?

I have generated and set cookie at frontend itself (React JS) using js-cookie library which was working fine until I was using it with httpOnly set as false. Now, my condition is set httpOnly as true but I'm not able to achieve this because I found…
0
votes
1 answer

nextjs 9.4 error on HOC private route with cookies

Trying to implement private ( authenticated ) routes in Nextjs using HOC and cookies but running into error below: TypeError: Object(...) is not a function at export default withPrivateRoute(Private); I have checked elsewhere in the app that…
BernardA
  • 1,391
  • 19
  • 48
0
votes
1 answer

React-toggle, with react-cookie with a compiled gatsby build

I am trying to use react-toggle with react-cookie on a compiled Gatsby build. For those that don't know, Gatsby compiles ReactJS into a static output (basically flat plain HTML with react on the client side. I basically want to use React-toggle to…
baihu
  • 451
  • 1
  • 4
  • 16
0
votes
2 answers

Make redux-auth-wrapper wait until session checked

so here is my auth.js code: import locationHelperBuilder from 'redux-auth-wrapper/history4/locationHelper'; import { connectedRouterRedirect } from 'redux-auth-wrapper/history4/redirect'; import { createBrowserHistory } from 'history'; // import…
Fran M
  • 229
  • 1
  • 4
  • 12
0
votes
1 answer

Is there a way to set a default value for a cookie when it expires at midnight using react-cookie?

I'm setting the cookie in react using react-cookie this.props.cookies.set("num_tag", num_tag, { expires: midnight }); I wanted to reset the value of the cookie when it expires at midnight and not be null.
0
votes
4 answers

How to include cookies with fetch request in Nextjs

Consider the following code Index.getInitialProps = async function({req}) { const res = await fetch("http://localhost/api/tiles"); const json = await res.json(); } Suppose the /api/tiles endpoint needs access to the uid cookie on the…
kahoha
  • 45
  • 1
  • 5
0
votes
1 answer

Where to store user's sensitive data?

I am developing a web with React, Redux and React-Cookie. In this web i have a login system, in which I send a POST request to my Backend API that will send me back the user's data I need for my components (including it's token for the cookie), and…
Fran M
  • 229
  • 1
  • 4
  • 12
0
votes
1 answer

How to trigger React Hook in Apollo Local State

So... I'm using Apollo for local state management in my React app. I'm also using react-cookie (which relies on react hooks internally). I'd like to do something pretty basic: const logout = async (_, args, {cache}) => { const cookies = new…
Dominik Teiml
  • 505
  • 1
  • 4
  • 12
0
votes
1 answer

How to read cookies with react?

I have a cookie on my browser and I want to read it with react, I use it like that: import Cookies from 'js-cookie'; console.log(Cookies.get('cookieName1')); when I run it, I get undefined on the console, but, the cookieName1 have a value on my…
Ichrak Mansour
  • 1,850
  • 11
  • 34
  • 61