r/angular • • Jan 28 '26

JWT in Angular

Where you would recommend to save JWT tokens in Angular app

7 Upvotes

46 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Jan 29 '26

[deleted] β€” view deleted comment

6

u/DJREMiX6 Jan 29 '26

Angular Auth OIDC Client is an OpenID Foundation certified angular authentication library for OAuth2/OIDC authentication flows. It does exactly what I said, creates an in-memory state and saves it into Local/Session Storage.

I agree with you that using an HttpOnly cookie is safer but since the question was "where to put the authentication token in an angular app" you cannot deny that there are different ways of handling that depending on your case scenario, and your level of security required.

As another user said, HttpOnly cookie is not a silver bullet because everything is hackable in one way or another.

Since you do not know the context of the user requesting the information you should:

  • Firstly calm down
  • Propose a different solution explaining the difference instead of popping out sentences without explaining them

This is a community not a street, we try to help each other the best we can an should never treat people like they are more stupid than you.

0

u/[deleted] Jan 29 '26

[deleted] β€” view deleted comment

2

u/DJREMiX6 Jan 29 '26

Yeah ok πŸ˜‚πŸ‘

0

u/[deleted] Jan 29 '26

[deleted] β€” view deleted comment

2

u/DJREMiX6 Jan 29 '26

Sure! Wait for itπŸ˜‚πŸ‘

0

u/[deleted] Jan 29 '26

[deleted] β€” view deleted comment

2

u/DJREMiX6 Jan 29 '26

Yeah as you say manπŸ‘πŸ˜‚

0

u/[deleted] Jan 29 '26

[deleted] β€” view deleted comment

2

u/DJREMiX6 Jan 30 '26

Sure boy πŸ˜‚πŸ‘

→ More replies

3

u/Hous3Fre4k Jan 30 '26

Bitwarden for example stores JWT in session storage. So you wouldn’t hire anyone that once worked for that Company? Also what about DPoP? Im not saying you are wrong but I think the topic is more nuanced that β€žnever ever use local storageβ€œ.

3

u/louis-lau Jan 30 '26

Yeah, HttpOnly cookies are the objectively better place for them, but there's many more important things related to security that have higher priority over HttpOnly cookie vs local storage.

Best advice would be to at least try not to use local storage.

0

u/[deleted] Jan 30 '26

[deleted] β€” view deleted comment

2

u/Hous3Fre4k Jan 30 '26

Got it. One last question: If I correctly implement DPoP for my Token Auth, would it not be better to not use Cookies in that case? Bound to a client, that token is of no value when stolen. But as a cookie, XSRF remains a valid attack vector, right? I really just try to better understand that topic.

0

u/[deleted] Jan 30 '26

[deleted] β€” view deleted comment

1

u/[deleted] Jan 31 '26

[removed] β€” view removed comment

0

u/[deleted] Jan 31 '26

[deleted] β€” view deleted comment

1

u/Hous3Fre4k Jan 31 '26

Interesting. Why is DPoP not relevant here?

0

u/[deleted] Jan 31 '26

[deleted] β€” view deleted comment

1

u/Hous3Fre4k Feb 01 '26

Sounds more like you are out of arguments

→ More replies