How to access a browser cookie in a react app

后端 未结 4 771
你的背包
你的背包 2021-02-10 20:43

This question is a bit popular but Im not having such luck. Im mostly a backend person so Im learning as I go along.

I have a cookie named connect.sid and v

4条回答
  •  天命终不由人
    2021-02-10 21:32

    I know that answer is not exactly what you want, but if you just want to authorize someone on the serverside i have an easy solution. Just add

    credentials: 'same-origin'

    to your AJAX request. If you have done that the cookie will get send with your connect.sid to the server and the server will handle the authentification for you.

提交回复
热议问题