I need direction… Because when we use normal jwt token auth or passport… Its simple… server generates the token & its checked for each request or page right?
What i don’t understand is if plasmic auth generates a token too… How does that work & if possible… How to make this work with pocketbase… because i think pocketbase offers easiest auth system.
Plasmic auth also generate a token, this token should be used when you have data source operations that you protected with plasmic auth (by setting a min role), this token just need to be passed into <PlasmicRootProvider> and the rest is handled by Plasmic. I am not familiar with PocketBase, but from reading their documentation, I believe you can call ensurePlasmicAppUser right after authenticating an us (https://pocketbase.io/docs/authentication/), this should be similar to https://github.com/plasmicapp/plasmic/blob/master/examples/supabase-auth-nextjs-pages-loader/utils/plasmic-auth.ts which is our example with supabase
// Validate user credentials (e.g., against your database)
// ...
// Authenticate the user with Plasmic using PocketBase
const result = await pb.collection('users').authWithPassword(email, password);
if (result.error) {
// Handle authentication error
res.status(401).json({ error: result.error });
} else {
// Authentication was successful
const { user: plasmicUser, token: plasmicUserToken } = result;
// Store the Plasmic user token securely (e.g., in a session or cookie)
// ...
res.json({ message: 'Authentication successful' });
}