# Api.access.deny causes redirect loop

**URL:** <https://community.auth0.com/t/api-access-deny-causes-redirect-loop/104298>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [April 7, 2023, 11:46am UTC](https://community.auth0.com/t/api-access-deny-causes-redirect-loop/104298 "2023-04-07T11:46:25Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mgls](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mgls/32/46156_2.png) [@mgls](https://community.auth0.com/u/mgls)\
**Post date:** [April 7, 2023, 5:58pm UTC](https://community.auth0.com/t/api-access-deny-causes-redirect-loop/104298/4 "2023-04-07T17:58:04Z")

</div>

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.

---

_[View the full topic](https://community.auth0.com/t/api-access-deny-causes-redirect-loop/104298)._
