Home > Back-end >  How to use the cookie from an http response
How to use the cookie from an http response

Time:06-28

I work in react on a front-end app which make API request.

The authentication route return an sid in response but also a cookie, when I go to the network part of firefox I see the cookie and its value.

enter image description here

Is it possible to access this cookie in js/react ?

Thanks,

CodePudding user response:

Can you explain more like cookie is coming from the api or it is set by front end itself?

CodePudding user response:

    const cookieValue = (`; ${document?.cookie}`).split('; cookie_consent=').pop().split(';')[0];

I am using this in chrome, here please update your key with 'cookie_consent', This might work!.

  • Related