0
How to store userid into headers ??
Creating a mern social media application. Want to send userid along with a post. How to store the userid ,so that it can be sent to server and linked together.
1 Odpowiedź
0
I am assuming the "userid" is required to perform an operation on the user.
You shouldn't store it in local storage. Instead set it from server as a HttpOnly and Secure cookie. This way, it will only be sent over HTTPS (ensuring it's encrypted) and saved inaccessible from JavaScript.
Cookies are set in the header and are sent with each request.