I am new to React and node. I am using React.js and Nodejs. I am doing an Axios POST request where I am sending data and in Node.js, I am creating a JWT token.
Now I want to use this token in auth middleware with the code I have made.
I get data in React.js from Node.js, using res.data. I can't save the data in localStorage or sessionStorage as it is not accessible by Node.js and gives error ReferenceError: localStorage is not defined
How to save the token so that I can get in Node.js?
Cookie,localStorageorSessionStorage, then you can send this token to your Node.js backend and verify your token there. Your request could either contain a bearer authorization header or simply send the token in a data object.