Sign in
Log inSign up

How do we store JWT in a web app?

Ankit Singhaniya's photo
Ankit Singhaniya
·Nov 23, 2016

I am using Rails API to generate a JWT on user login. Now I need to persist this token. After some reading, I found out that there are two ways of doing this. I can either use local storage or cookies. They both have the problem of XSS and CSRF respectively. I am not sure how this should work. I am using react in the frontend.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct