# Logout via onExecutePostLogin action

**URL:** <https://community.auth0.com/t/logout-via-onexecutepostlogin-action/103002>\
**Category:** Get Help\
**Tags:** sessions, logout\
**Created:** [March 21, 2023, 3:33pm UTC](https://community.auth0.com/t/logout-via-onexecutepostlogin-action/103002 "2023-03-21T15:33:31Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 7, 2023, 6:44pm UTC](https://community.auth0.com/t/logout-via-onexecutepostlogin-action/103002/9 "2023-04-07T18:44:44Z")

</div>

Hey @gparascandolo thanks for jumping in here!

That totally makes sense to me and seems a good solution - Something similar is mentioned here:

> [@Api.access.deny causes redirect loop](https://community.auth0.com/t/api-access-deny-causes-redirect-loop/104298/4):
>
> Thanks @rueben.tiow Our solution: we don’t use api.access.deny() anymore but use api.redirect.sendUserTo('https://{auth0\_tenant}.eu.auth0.com/v2/logout?returnTo=https%3A%2F%2Fexample.com'). With this, the not-allowed user will be logged out immediately after the login and gets redirected to the specified returnTo URL.

Hope this helps everyone!

---

_[View the full topic](https://community.auth0.com/t/logout-via-onexecutepostlogin-action/103002)._
