DEV Community

Discussion on: Fetch in react js returns 401 (unauthorized) while passing access token

Collapse
tqbit profile image
tq-bit

Ye, that slipped my attention, my apologies.
The rest of your code doesn't look suspicious. Since you're storing the token in your state, you could try and instead save it as a clientside cookie, explicitly sending it to your backend. Else, I'd see for the backend documentation or verify error logs, if available.