My application has an API part and a website-part. On the website, the user can log in and gets a JWT bearer token from the API.
My question now is:
Where should I store that token?
Some say, store it in Cookie (while others say "don't, because CSRF"), some say HTML5 Web Storage, others say use Session (while other say, "don't use Sessions in ASP Net Core") and I saw an article where someone stored the auth-token in a database (??). So, what's now the correct place?
MVC-web application with many controllers and a lot of views
If you have to use the token to authenticate every request to your MVC app I think the best option is store it in session cookie because, if not, the web browser are not going to send the token authomaticaly in every request and it will be a pain in the ass.
Now, to secure the cookie and requests:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With