Redirect users with custom AUTH.

What are you trying to do? (please be as specific as possible and include relevant screenshots, code snippets, and reproduction steps)

Hello guys, i have implemented supabase AUTH in my project alongside Plasmic’s token authorization following the documentation, everything works as expected the only issue is that i can’t find anywhere how to access if a user has the needed role for a page.

with plasmic auth enabled if the role needed for a page was not anonymous it would redirect you to sign in, but not if it was Anonymous. right now if i visit the same page with custom authorization, it will simply show “You don’t have access to this page” how can i read whatever triggers “You don’t have access to this page” to use in my middleware.

I want to do that because if i were to setup a session based middleware it will always redirect users regardless if the page has “Anonymous” Role needed so i want to use the roles already setup from plasmic.

i could even setup the redirects through a global context but i can’t find the “Role Needed” state from the page, or variable anywhere either on code or plasmic studio.

Help on the topic would be greatly appreciated.

Hello, currently the “Role Needed” data is not available via any APIs. If you use codegen, however, you could inspect the Plasmic file for the page, and you should find the role in the component PlasmicPageGuard__.