# Action is not halting / exiting Flow early when using api.access.deny

**URL:** <https://community.auth0.com/t/action-is-not-halting-exiting-flow-early-when-using-api-access-deny/95390>\
**Category:** Get Help\
**Tags:** extensibility, actions-extensibility\
**Created:** [November 30, 2022, 5:02pm UTC](https://community.auth0.com/t/action-is-not-halting-exiting-flow-early-when-using-api-access-deny/95390 "2022-11-30T17:02:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neill\_0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/neill_0/32/34638_2.png) [@neill\_0](https://community.auth0.com/u/neill_0)\
**Post date:** [November 30, 2022, 5:02pm UTC](https://community.auth0.com/t/action-is-not-halting-exiting-flow-early-when-using-api-access-deny/95390/1 "2022-11-30T17:02:29Z")

</div>

I’m working on a Flow in our Auth0 tenants that has three Actions. The first action includes a conditional call to `api.access.deny`. I expect when this deny call is made for the Flow to exit, as per the Auth0 action docs here: [Actions Triggers: post-login - API Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/api-object)

When the deny is triggered (which I can verify is happening because of the error message we receive back from Auth0) it _does not_ exit the Flow but instead carries on and executes the next two Actions. This causes a corrupted state in our full auth flow that the user cannot escape from.

I’d like answers to the following questions:

- Is the documentation for `api.access.deny` correct; that is `deny` should exit the Flow at the end of that Action and _not_ call subsequent Actions?
- Is there anything that can negate or cancel the behaviour of calling `deny` in an Action?
- How should I exit a Flow from an Action if this is actually incorrect documentation?

Thanks,  
Neill

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [November 30, 2022, 7:21pm UTC](https://community.auth0.com/t/action-is-not-halting-exiting-flow-early-when-using-api-access-deny/95390/3 "2022-11-30T19:21:19Z")

</div>

Hi @neill_0,

Welcome to the Auth0 Community!

I understand that you have experienced issues with exiting the Post Login Action when using the `api.access.deny()` method.

First, to address your questions:

> [@neill\_0](#):
>
> Is the documentation for `api.access.deny()` correct; that is `deny` should exit the Flow at the end of that Action and _not_ call subsequent Actions?

Yes, this is correct and the expected behavior.

> [@neill\_0](#):
>
> Is there anything that can negate or cancel the behaviour of calling `deny` in an Action?

No, the `api.access.deny()` method will exit the Action flow and show the error message to the user.

> [@neill\_0](#):
>
> How should I exit a Flow from an Action if this is actually incorrect documentation?

The `api.access.deny()` is the correct method to exit a flow from an Action.

After testing this myself, I could not reproduce the same observations as you. Instead, I was able to exit the Action flow successfully. I checked this using the Real-time Webtask Logs extension with two additional Action scripts to print a message before and after the Deny Action script to verify the behavior.

In this situation, I would recommend using the [Real-time Webtask Logs Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs) to troubleshoot your Action scripts.

To add on, I have checked your Action scripts on your Tenant and can see the scripts you mentioned and see no visible issues with them. I would expect the Action to exit as usual when it reaches your conditional statements.

I hope this helps!

Please let me know how things go and if you have any further questions.

Thanks,  
Rueben

---

<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:** [December 14, 2022, 7:22pm UTC](https://community.auth0.com/t/action-is-not-halting-exiting-flow-early-when-using-api-access-deny/95390/4 "2022-12-14T19:22:13Z")

</div>

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