skip to Main Content
[enter image description here][1]Im developed web app react frontend and node backend.when user login I try to save cookie in browser .in postman testing cookie show but not save in browser.(I used also jwt authentication)In browser this error show,* Indicate whether a cookie is intended to be set in a cross-site context by specifying its SameSite attribute* .and I update with sameSite none and secure true but still not save cookie in browser.How to slove this

2

Answers


  1. Did you enable the Cors middleware on the server-side?
    Here’s how you can do it How to enable cors nodejs with express?

    Login or Signup to reply.
  2. If you are hosting your web app on localhost you should set secure:false or else cookies are not going to work. You should set secure:true only when you deploy your web app. The reason is setting this option to true says that the cookies should be send over https (secure) connection but when you are on localhost you are on http (not secure) connection so coookies will not be sent. For more info check a previous question:

    Why setting the cookie.secure to True in express session allows session id and data to persist?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search