# Getting rid of appSession token when logging out

**URL:** <https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578>\
**Category:** Get Help\
**Tags:** sessions, logout\
**Created:** [November 16, 2022, 10:45pm UTC](https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578 "2022-11-16T22:45:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bengt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bengt/32/35760_2.png) [@bengt](https://community.auth0.com/u/bengt)\
**Post date:** [November 16, 2022, 10:45pm UTC](https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578/1 "2022-11-16T22:45:09Z")

</div>

We have a bit of an issue. We kind of ended up with a bit of a Frankenstein rollout of Auth0, because we may have used another authentication solution (that shall not be named) but had to move to a better documented version (thanks team auth0 ) 🙂

Generally, it works well, but we have an issue with an appSession token stored in a cookie, and we’re trying to figure out a sensible way of getting rid of it.

Basically, when you first log in, auth0 sets two tokens, a appSession and a refresh\_token, and it works all nice.

 ![CleanShot 2022-11-16 at 22.25.37@2x](https://global.discourse-cdn.com/auth0/original/3X/0/3/03aa940812bb338836efd4b80551b4f688cc727e.png)

However, when you click the logout button, auth0 removes the refresh\_token, but not the appSession:

 ![CleanShot 2022-11-16 at 22.24.31@2x](https://global.discourse-cdn.com/auth0/original/3X/7/1/71e539d1564e768d317825a1cab5e90ebf1177b5.png)

Part of the problem may be that we are not deploying it purely as an SPA (because of above mentioned other solution) we ended up routing all auth calls via the backend API, instead of direct to auth0 and then sending an access token.

Currently, if you log out and try to log in again, we get a 502 error. We can get it working again by manually resetting or deleting the value on appSession. Our challenge is, appSession is HttpOnly, so we need to figure out a way to delete it from the front end.

Has anyone seen this issue and have a simple solution for it?

---

<div class="post-metadata">

**Author:** ![ian4](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ian4/32/41565_2.png) [@ian4](https://community.auth0.com/u/ian4)\
**Post date:** [October 15, 2023, 12:34pm UTC](https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578/2 "2023-10-15T12:34:25Z")

</div>

Can anyone from Auth0 please comment on this?

@bengt curious if you found a solution?

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [October 16, 2023, 10:12am UTC](https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578/3 "2023-10-16T10:12:46Z")

</div>

Hey there @ian4 !

Please check this [discussion](https://github.com/auth0/express-openid-connect/issues/393#issuecomment-1267000608) and consider setting an absolute duration time for the [app session](https://auth0.github.io/nextjs-auth0/interfaces/config.SessionConfig.html) (appSession cookie) to a short value and adding a silent authentication to extend the session (as set in the IdP settings) without prompting a user to provide credentials.

---

<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:** [October 30, 2023, 10:13am UTC](https://community.auth0.com/t/getting-rid-of-appsession-token-when-logging-out/94578/4 "2023-10-30T10:13:44Z")

</div>

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