Hello, I want to integrate Plasmic into an existing Nextjs codebase utilizing Appwrite authentication. Can I pass my Appwrite users and session tokens into Plasmic to use for routing and dynamic data? The authentication system works in the existing codebase, but how do I get it to communicate with Plasmic?
You can register a global context that reads your Appwrite session and exposes the user data through a DataProvider. You can then use $ctx.user in Studio for dynamic text, conditional visibility, etc.
Protected routes: You can add page metadata (e.g. requiresAuth) in Page settings, and check it against the Appwrite session in your catch-all page to redirect logged-out users. Something like this
Thanks for the reply, that helps a lot. Is there an code example of a global context reading a session from a third party like Appwrite? I see the example in the global context documentation link but I don’t see how it relates to a third party session? And sorry if I’m just missing something.