Reputation: 125
I am currently implementing an angular application where I am getting an Authentication token from backend. After login I am storing that token in local storage of the browser. Is there any other way to store the Auth token. I am trying avoid local storage or session storage or cookie.
Please suggest if there is any solution. Also, I am getting an refresh token after a certain point of time of login(approx 20 mint).
Upvotes: 1
Views: 4297
Reputation: 2374
There are limited options. You need a storage which does not get destroyed after a full page reload. So localstorage or session storage is totally fine to store a token because they normally expire at some point. Cookies would also be an option.
Another alternative I know about would be the index db of the Browser:
https://www.npmjs.com/package/ngx-indexed-db
This is a lightweight database available in all modern Browsers.
Upvotes: 1