# Here is a question I sent to Mosh Hamidani and Max SwartzMuller about storing authentication tokens on local storage

**URL:** <https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328>\
**Category:** JWT.io\
**Created:** [April 1, 2020, 1:37pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328 "2020-04-01T13:37:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamord](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tamord/32/20225_2.png) [@tamord](https://community.auth0.com/u/tamord)\
**Post date:** [April 1, 2020, 1:37pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/1 "2020-04-01T13:37:21Z")

</div>

Hi,

My name is Mody Tal my email is: [tamord@gmail.com](mailto:tamord@gmail.com) and I have purchased and watched the video of the course: Angular - The Complete Guide (2020 Edition)

Well, Just a small question, In lecture 303: “Auto Login” You have mentioned that the web API (for authentication) which is firebase on our case,

they should return a token with info on the authenticated user, and also you have mentioned that the JWT token should be stored on local storage

however, when I googled: “put authentication in local storage” the question: Is it safe to store the auth token in local storage?

Because, here is an answer I got from google about storing authentication info on local storage:

"A JWT needs to be stored in a safe place inside the user’s browser. If you store it inside localStorage, it’s accessible by any script inside your page (which is as bad as it sounds, as an XSS attack can let an external attacker get access to the token). Don’t store it in local storage (or session storage)

So, the question is where should I store the token? Because both local storage and cookies are visible to the user (as you have mentioned they can inspect the local storage or cookies from application tab in the google chrome inspectors and they can even modify the local storage I think

I hope you can answer my question as I want to make authentication as secure as possible.

Thanks Mody Tal,

[tamord@gmail.com](mailto:tamord@gmail.com)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 1, 2020, 1:42pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/2 "2020-04-01T13:42:21Z")

</div>

Hey there!

Is this a course that was developed by Auth0?

---

<div class="post-metadata">

**Author:** ![tamord](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tamord/32/20225_2.png) [@tamord](https://community.auth0.com/u/tamord)\
**Post date:** [April 1, 2020, 1:51pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/3 "2020-04-01T13:51:24Z")

</div>

hi,

the course is called: Angular - The Complete Guide (2020 Edition)  
and is hosted in Udemy. I have purchased the course.

So, I Wanted to know where to store the authentication token?

because, when I googled: “put authentication in local storage”

I got the answer:  
" A JWT needs to be **stored** in a **safe** place inside the user’s browser. If you **store** it inside **localStorage** , it’s accessible by any script inside your page (which is as bad as it sounds, as an XSS attack can let an external attacker get **access** to the **token** ). Don’t **store** it in **local storage**"

I don’t know who wrote this tip however since google put this snippet on the 1st result  
I afraid it’s correct and

really wanted to know where to put the auth token to make the user be able to log in  
and then leave and return to the website and stay connected

Thanks

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 1, 2020, 1:56pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/4 "2020-04-01T13:56:22Z")

</div>

I guess this question should be addressed by course authors as we as Auth0 employees have no information about the guidance and content presented in the course and thus we can’t suggest anything cause we don’t know if it will work with what is shown in there.

Every course on Udemy has its discussion section so I guess it will be good to look for information from authors there.

---

<div class="post-metadata">

**Author:** ![tamord](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tamord/32/20225_2.png) [@tamord](https://community.auth0.com/u/tamord)\
**Post date:** [April 1, 2020, 2:00pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/5 "2020-04-01T14:00:33Z")

</div>

ok, so I will go to the udemy course and post the question

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 1, 2020, 2:03pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/6 "2020-04-01T14:03:35Z")

</div>

Perfect thanks a lot!

---

<div class="post-metadata">

**Author:** ![tamord](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tamord/32/20225_2.png) [@tamord](https://community.auth0.com/u/tamord)\
**Post date:** [April 1, 2020, 2:07pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/7 "2020-04-01T14:07:35Z")

</div>

I reached AUTO0 website from JWT website

> **[JWT.IO](https://jwt.io)**
>
> JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.

I clicked on Ask from the menu  
and this brought me to here  
that’s why I posted the question here  
Mody

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 1, 2020, 2:17pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/8 "2020-04-01T14:17:09Z")

</div>

Gotchya! But as I’ve said the course content wasn’t developed by Auth0 and I have no idea what’s the guidance in that course so I don’t want to recommend anything cause I cannot prove that it will be working with what is presented in the course content or is it safe

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 16, 2020, 2:17pm UTC](https://community.auth0.com/t/here-is-a-question-i-sent-to-mosh-hamidani-and-max-swartzmuller-about-storing-authentication-tokens-on-local-storage/40328/9 "2020-04-16T14:17:12Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
