# How to clear Auth0 session cookie inside Action

**URL:** <https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [June 5, 2023, 8:23am UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517 "2023-06-05T08:23:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremie.poisson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeremie.poisson/32/33711_2.png) [@jeremie.poisson](https://community.auth0.com/u/jeremie.poisson)\
**Post date:** [June 5, 2023, 8:23am UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/1 "2023-06-05T08:23:30Z")

</div>

Hi,

We have a current workflow for authentication :

- User access application
- User is redirected to Auth0 New Universal Login
- User authenticates to Custom Database (session cookie created)
- User is redirected by Action to an external Custom MFA page
- In some case MFA is not successfull → the MFA page redirect to Auth0 /continue URL so that Action can verify session token and invalidate it (it works)

The thing is that the last step simply blocks the authentication part using an api.access.deny(), but this doesn’t clear the session cookie. If we try to authenticate again we will skip the login/password page and get directly redirected to MFA pages.

How can we do this in Actions, if we can’t here how can we do it either in our custom MFA page (html/javascript) or inside application.

Thank you

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 13, 2023, 6:46pm UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/3 "2023-06-13T18:46:51Z")

</div>

Hi @jeremie.poisson,

Does workaround described in this topic solve your issue?

> [@User stuck in MFA stage of login if they are unable to pass MFA](https://community.auth0.com/t/user-stuck-in-mfa-stage-of-login-if-they-are-unable-to-pass-mfa/69574):
>
> When using the New Universal Login Experience configured with Auth0 Guardian SMS MFA, If the user is unable to pass MFA, they will be stuck on that page and there is no way to invalidate their session to sign in with a different user. Refreshing the page in attempt to sign in with a different account will skip the username + password flow and bring you straight back to this MFA challenge. The only way for the user to unblock themselves is for them to delete their cookies. I see two solutions to…

---

<div class="post-metadata">

**Author:** ![jeremie.poisson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeremie.poisson/32/33711_2.png) [@jeremie.poisson](https://community.auth0.com/u/jeremie.poisson)\
**Post date:** [June 14, 2023, 6:29am UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/4 "2023-06-14T06:29:55Z")

</div>

Hi,

Not a all.

But using api.redirect() with app logout URL instead of using api.acces.deny() does work though.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 14, 2023, 12:21pm UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/5 "2023-06-14T12:21:13Z")

</div>

If you didn’t want to redirect back to Auth0 (/continue), you should be able to logout directly from your custom MFA page.

---

<div class="post-metadata">

**Author:** ![jeremie.poisson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeremie.poisson/32/33711_2.png) [@jeremie.poisson](https://community.auth0.com/u/jeremie.poisson)\
**Post date:** [June 14, 2023, 12:59pm UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/6 "2023-06-14T12:59:58Z")

</div>

Indeed, but my custom MFA page doesn’t have application context.

Auth0 Action does have it.

---

<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:** [July 20, 2023, 3:34pm UTC](https://community.auth0.com/t/how-to-clear-auth0-session-cookie-inside-action/108517/7 "2023-07-20T15:34:33Z")

</div>

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