Jia Huang
Jia Huang

Reputation: 97

How and where do I store a CSRF token in React?

Where do I store the CSRF token in my React page? I read that it should be stored in a hidden input field, but then how do I access it? It seems like the only way to access it is by interacting with the DOM, which I was told to avoid doing when using React. I also read that it is safe to store CSRF tokens in React states. Wouldn't this make it vulnerable to XSS attacks?

Upvotes: 2

Views: 330

Answers (0)

Related Questions