How to store authorization tokens in a React app?
Answer
•Do not store tokens in localStorage if XSS risk is high.
•Prefer httpOnly cookies (if possible).
•Separate auth state and user profile.
•Add refresh tokens via backend protocol.
•Log out and handle 401/403 responses.
Was this answer helpful?