Ask a question
Here's a super quick Bubble security tip for you. Imagine I've got an app, many no code SaaS apps built with Bubble are going to have an area like this, which is part of my app that I don't want to show to users who aren't logged in. I only want to show this to users who are logged in.
But there'll be parts of my app that I want to show to users who aren't logged in, such as a registration or login form. My app is split between a logged-in area and a logged-out area. Now, what and how is the right way to go about this?
Two Bubble Security Options
Well, there are two options, and one is the one to go for. We've got a do when statement 'Do when current user is logged out', send them to the index page. That's where I could put a registration form, I could put a login form, or I've got the 'User is logged out'. That's the difference between selecting that option there or a do when condition is true statement.
The Importance of 302 Redirects
Now, there is a huge difference between these two, which is what redirect happens. When you use a user is logged out statement, that occurs before Bubble loads in the page content. It's known as a 302 redirect. It happens server side. But when you run a statement such as this, you may experience that Bubble loads in some of the page content before this statement is true, or Bubble detects that this statement is true, and then you run this workflow here.
Protecting Your Bubble Database and UI
Now, to underline all this, the only way to properly protect data in your Bubble database is to set up the appropriate privacy rules. But if you want to protect UI, like a dashboard to your users, and you don't want logged out users to ever access that dashboard, then you should be using this statement here. User is logged out and then Go to page.
And that is the correct way to do it with the server side redirect without any of the page content you might want to protect loading into the user's browser.
Further Bubble Security Tutorials and Learning Resources
If you've liked this video, we'd appreciate if you could subscribe and give it a like on YouTube. We've got over 160 Bubble tutorial videos now. We're basically churning out one video a day, and you can find all of them.