Restricting SQL Data Queries by Current User in Plasmic

Hello.

I’m trying to restrict my SQL data queries by current user properties (e.g. WHERE id = < logged in user ID >).

I’ve built a dashboard in Plasmic, and integrated it in to my plain React app that has its own authentication system. Now I need to ensure that data queries for this dashboard only fetch data specific to the current authenticated user.

My understanding is that to achieve this, I need to create corresponding Plasmic users from my app (calling ensurePlasmicAppUser). This would allow Plasmic to recognize the current user, provided I pass in the user ID from my app. Is this understanding correct?

Additionally, could someone clarify what is meant by “self-hosted” in this context (doco says: Note that if you use a custom auth provider, you must self-host)? Is that the created apps or the entire platform?

Reference: Auth integration | Learn Plasmic

Hi,

Your understanding is correct. You need to call ensurePlasmicAppUser to make Plasmic recognize the user and then pass in the user object into PlasmicRootProvider.

In this context, it refers to your app. This is to indicate that custom auth won’t work with Plasmic Hosting.

1 Like

Thanks for confirming!