# Destroy session after user delete

**URL:** <https://community.auth0.com/t/destroy-session-after-user-delete/58055>\
**Category:** Get Help\
**Tags:** sessions, delete-user\
**Created:** [February 17, 2021, 8:56pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055 "2021-02-17T20:56:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcasa](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pcasa/32/12872_2.png) [@pcasa](https://community.auth0.com/u/pcasa)\
**Post date:** [February 17, 2021, 8:56pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/1 "2021-02-17T20:56:05Z")

</div>

After a user is deleted via API or Dashboard, is there a way to in-validate any active session. For example, if the Auth0 ID does not exist, force a logout or respond with a status code of 401?

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [February 22, 2021, 2:09pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/2 "2021-02-22T14:09:19Z")

</div>

Hi @pcasa,

When a user is deleted, their **Auth0** session is invalidated, and so the next time they go to fetch a new Access Token from Auth0 it will fail and ask for a login. However, there is **no synchronisation between Auth0 and your application** ; your application will need to check in with Auth0 to ensure the user still has a valid session on the **Auth0** side, and act appropriately if Auth0 asks for a login (e.g. destroy their local session and redirect to the login page of your app).

To this end, I would recommend reducing your Access Token lifetimes to as short as is practical for your application, and use silent authentication to check the user still has a session with Auth0 when these tokens expire, or if the user attempts to access something sensitive for example.

> **[Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication)**
>
> Learn how to keep users logged in to your application using silent authentication.

---

<div class="post-metadata">

**Author:** ![pcasa](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pcasa/32/12872_2.png) [@pcasa](https://community.auth0.com/u/pcasa)\
**Post date:** [February 22, 2021, 2:22pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/3 "2021-02-22T14:22:17Z")

</div>

Does Access token requests affect our rate limits?

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [February 22, 2021, 2:31pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/4 "2021-02-22T14:31:11Z")

</div>

Yes these will count towards the rate limits on the Authentication API ([Authentication API Endpoint Rate Limits](https://auth0.com/docs/policies/rate-limit-policy/authentication-api-endpoint-rate-limits)), so you would need to find a balance between your tenant’s plan and how often your application checks the user still has a valid session, as an access token will remain valid until it expires.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 25, 2021, 12:28pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/5 "2021-02-25T12:28:24Z")

</div>

Let us know @pcasa if you have any additional questions!

---

<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:** [March 12, 2021, 12:28pm UTC](https://community.auth0.com/t/destroy-session-after-user-delete/58055/6 "2021-03-12T12:28:32Z")

</div>

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