Hi all, I'm curious about how you all handle authentication and access control (e.g., restricting pages for specific user roles/groups) in Toddle. What’s your preferred approach for managing user access? Do you rely on an app provider component, custom actions, or something else? If anyone has experience integrating Supabase for this, I'd love to hear your insights! Thanks in advance!
Tod
18 days ago
Great energy @Jay | DRAGXN! Your continuous contribution to the toddle Community just made you advance to Community Level 1!
Lucas G
18 days ago
You can search up previous discussions on this for details but essentially people often use a wrapper component to handle different contexts, one of which is commonly auth related. For Supabase, you can use the auth endpoint to check for the user and handle redirects
Jay | DRAGXN
16 days ago
@Lucas G Hey Lucas, I'd like your opinion on this. I have a protectedPage component that's just a combo of my appProvider and authProvider.. the authProvider auto fetchs the user data and I thought I would be able to access that data from the slot. Is that not the case?
I'd use the provider components everywhere and have components use the contexts
Jay | DRAGXN
16 days ago
Okay then I'm a bit confused. Would you happen to have an example of something similar to what I'm trying to do? I thought it could be something like this appProvider -> authProvider (Gets User Data) -> Slot -> Anything here can get user data.
Yea I got that part. I'm not sure how to explain it but basically: ✅ authProvider (Gets User Data) -> Direct children can get the information. ❌ authProvider (Gets User Data) -> Slot -> Children that aren't components can't get the data. So if I had a H1 and wanted to display the email from User Data, I couldn't. Does that make sense?