Log out current user during Forms for Actions

Hello :wave:

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!

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.

Thanks,
Rueben

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!

Hi @Will956,

Thanks for your reply.

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)

For example:

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.

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

1 Like

Indeed this looks better!

Thanks for your help!

1 Like

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