# Store token in "session storage" instead of "local storage"

**URL:** <https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848>\
**Category:** General\
**Created:** [27 January 2021 09:11 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848 "2021-01-27T09:11:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mapero](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mapero/32/36013_2.png) [@mapero](https://discourse.nodered.org/u/mapero)\
**Post date:** [27 January 2021 09:11 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848/1 "2021-01-27T09:11:56Z")

</div>

Hi,

we have the requirement, that a user is logged out when closing a site or tab. We already use custom-authentication-tokens, and it works flawless. The only down side is, that node-red stores the token in local storage, which "overcomes" closing the tab/site. Can we configure the location of token storage to use session storage instead of local storage?

Thanks.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 January 2021 12:09 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848/2 "2021-01-27T12:09:51Z")

</div>

If you are using node-reds persistent context, you can define is as being stored in memory. If you have need for some things to be stored and recovered and some things to ‘go away’ you can define two locations, one in storage and one in memory. Here is a write up about understanding it: [A guide to understanding 'Persistent Context'](https://discourse.nodered.org/t/a-guide-to-understanding-persistent-context/4115)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [27 January 2021 12:59 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848/3 "2021-01-27T12:59:38Z")

</div>

Hi @mapero

That is not something that is configurable today.

But we do have an issue open to move away from using localStorage entirely and shift to cookies. We will be able to add new config options on the default lifetime of the cookie and whether it should be tied to the browser session or not.

> <https://github.com/node-red/node-red/issues/2657>
>
> What are the steps to reproduce?
> Bring up a nodered instance that makes use of adminAuth in the settings file.
> Log in.
> Bring up...

I want to try to get that done for 1.3, but needs to be done with plenty of care. It may end up being something we have to hold back until Node-RED 2.0 in April.

---

<div class="post-metadata">

**Author:** ![mapero](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mapero/32/36013_2.png) [@mapero](https://discourse.nodered.org/u/mapero)\
**Post date:** [27 January 2021 13:28 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848/4 "2021-01-27T13:28:43Z")

</div>

Thank you very much. That information helps a lot.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 February 2021 13:29 UTC](https://discourse.nodered.org/t/store-token-in-session-storage-instead-of-local-storage/39848/5 "2021-02-10T13:29:35Z")

</div>

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