How to Set Up Optional 2FA in Bubble App?

Hello,

I have enabled 2FA in my Bubble app, but it is optional for users. If a user configures 2FA, it should be activated at their next login. I’ve written a workflow on the login page that checks after a successful login—if 2FA is enabled, the user is redirected to the 2FA verification page. If 2FA is not enabled, the user should be redirected without going to the 2FA verification page.

However, I am encountering an error: "Log the user in must be the last action in the workflow when you use 2-factor authentication."

I’m not sure how to handle this scenario in the Bubble workflow. Can anyone guide me on the proper approach?

2 Likes

I have exactly the same question. I have different type of users/portal and I don’t need 2FA for all of them, so I need to find a way to make it optional.

What you need to do is split your workflow. After a successful login, check if the user has 2FA turned on. If they do, just redirect them to the 2FA verification page.

If they don’t, send them straight to your main app page. Bubble will take care of the rest for 2FA users once they verify