Best approach to directing users who aren't logged in?

I have some pages that should only be able to be accessed by “logged in users”, however, if they know the url, they can still access them. How can I redirect them to the “index” page if they type the url in and ARE NOT logged in yet?

Seems like Bubble rookie level, but I’m tired and drawing a blank right now.

Hi @sounderly.help :slight_smile: You can add a redirect workflow on the pages that are only for logged in users in this way:

This way, if the User isn’t logged in, they’ll automatically be re-directed back to your app’s home page.

If you have a reusable element that is only used for logged-in users, and placed on the ‘logged-in pages’, you could instead place the redirect workflow inside that reusable element (instead of adding it individually to each ‘logged-in only’ page). That would also re-direct logged out users back to the home page in the same way. Either way works! :slight_smile:

For extra security, you can set up privacy roles to ensure logged-out users won’t see any data that they aren’t supposed to see. You can also set the groups on the logged-in pages to not be visible on page load:

And add conditionals to only make them visible when the Current User is logged in:
Conditional

2 Likes

thank you!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.