My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

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.