# Log out current user during Forms for Actions

**URL:** <https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [July 13, 2024, 7:00pm UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817 "2024-07-13T19:00:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will956](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will956/32/42310_2.png) [@Will956](https://community.auth0.com/u/Will956)\
**Post date:** [July 13, 2024, 7:00pm UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/1 "2024-07-13T19:00:57Z")

</div>

Hello 👋

I would like to know if it is possible to log out the current user when, for some reason, the user doesn’t want to proceed with our progressive profiling steps.

Example:

1. user connects
2. he is redirected to our progressive profiling form asking for phone number
3. he doesn’t want to, so he simply closes the page
4. when he comes back on our site and click on “login”, he is automatically redirected to the progressive profiling form since the Auth0 session is still valid (and we do not want to prompt the login page if a session is still running on Auth0)

We want to give the user a chance to connect to another account in that case and to not be “blocked” in that loop.

Do you have any clues on how we can achieve that?

Thanks!

---

<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:** [July 15, 2024, 7:08pm UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/3 "2024-07-15T19:08:47Z")

</div>

Hi @Will956,

AFAIK, there unfortunately isn’t any way to log out the current user during login with Forms for Actions.

However, you could include a skip button (Jump button block) on the Form so that the user can complete the authentication flow. That way, they can choose to log themselves out later and re-login with another account. See [Nodes and components](https://auth0.com/docs/customize/forms/nodes-and-components#available-blocks-in-forms).

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![Will956](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will956/32/42310_2.png) [@Will956](https://community.auth0.com/u/Will956)\
**Post date:** [July 15, 2024, 7:32pm UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/4 "2024-07-15T19:32:34Z")

</div>

Hey @rueben.tiow,

Thanks for your reply. Unfortunately, this will not work for us since we do not want to allow login if the phone number is not filled (or we can imagine having a terms & conditions restriction there).

But I guess we can implement that jump button to bypass that restriction and then make logic in our application to log out the current user if he doesn’t have that phone number filled in.

This should work, but I can imagine having a native log-out system within Forms for Actions still makes sense.

Do you know if it’s something already planned? Or should I open a feature request for that?

Thanks!

---

<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:** [July 17, 2024, 6:49pm UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/5 "2024-07-17T18:49:25Z")

</div>

Hi @Will956,

Thanks for your reply.

> [@Will956](#):
>
> Unfortunately, this will not work for us since we do not want to allow login if the phone number is not filled (or we can imagine having a terms & conditions restriction there).

In this case, you might not want to use the jump button. Instead, just use the default continue button. Then, you can add a **Flow** after the additional sign-up step (asking for phone number) to update the `user_metadata` and resume the authentication flow.  
(Reference: [Use Cases: Configure additional signup steps using Forms](https://auth0.com/docs/customize/forms/configure-additional-signup-steps))

For example:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/f/a/fa51166feb6a54fabe34598b46772b50ca584588.png)

At this point, you can add a new post-login action that checks whether the user has filled in a phone number. If not, you can deny them access until they have filled in their phone number.

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (!event.user.user_metadata.phone_number){
    api.access.deny("Please fill out your phone number")
  }
};

```

I hope this helps!

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![Will956](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/will956/32/42310_2.png) [@Will956](https://community.auth0.com/u/Will956)\
**Post date:** [July 18, 2024, 8:43am UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/6 "2024-07-18T08:43:12Z")

</div>

Indeed this looks better!

Thanks for your help!

---

<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:** [August 1, 2024, 8:44am UTC](https://community.auth0.com/t/log-out-current-user-during-forms-for-actions/138817/7 "2024-08-01T08:44:02Z")

</div>

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