# What exactly does expireInactiveSessions flag?

**URL:** <https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950>\
**Category:** Uncategorized\
**Tags:** session-token\
**Created:** [September 1, 2021, 3:43pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950 "2021-09-01T15:43:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [September 1, 2021, 3:43pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950/1 "2021-09-01T15:43:12Z")

</div>

Could anyone give me a hint what exactly the `expireInactiveSessions` does? In the documentation I found:

> Sets wether we should expire the inactive sessions, defaults to true

I tried to set `sessionLength` to only 120 seconds in the server custom settings and after this any request correctly throws an error:

> **code=209 error=Session token is expired.**

but it does the same no matter if I set `expireInactiveSessions` false or true and in both cases the session stays in the database (not deleted). So what does this actually affect?

Thanks for clarification!

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 1, 2021, 3:47pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950/2 "2021-09-01T15:47:01Z")

</div>

Take a look here: [parse-server/Config.js at 9ea355b4635226ae4da17c8cc5fb0321e3fdec5e · parse-community/parse-server · GitHub](https://github.com/parse-community/parse-server/blob/9ea355b4635226ae4da17c8cc5fb0321e3fdec5e/src/Config.js#L432)

Basically, if `expireInactiveSessions` is set false, new sessions are created with no expiration date.

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [September 1, 2021, 6:04pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950/3 "2021-09-01T18:04:39Z")

</div>

Ah, I see. Do you think I should add into the documentation that your sentence “new sessions are created with no expiration date.”? Because that would explain it better I believe.

> Sets wether we should expire the inactive sessions, defaults to true. If false, all new sessions are created with no expiration date.

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [September 2, 2021, 3:24pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950/4 "2021-09-02T15:24:37Z")

</div>

Yes. I think it would be a good addition.

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [September 6, 2021, 1:26pm UTC](https://community.parseplatform.org/t/what-exactly-does-expireinactivesessions-flag/1950/5 "2021-09-06T13:26:05Z")

</div>

I created a related [pull request](https://github.com/parse-community/parse-server/pull/7552), hopefully all good. Let me know if I should adjust anything.

Thank you!
