So I am currently building a SaaS that features an invitation system. The general workflow is:
- User A signs up
- User A creates an organization as owner
- User A creates an invitation
- User B receives an invitation link
- User B signs up and joins the organization
I want to show some public information about the organization before the user signs up:
User A has invited you to join Organization X (some profile picture, other public information)
Now naturally, the invitation code is public and the whole invitations table should not have an RLS policy that prevents accessing the invite before being authenticated. However, I am thinking that it would be more secure to protect access to this table so that only people who have an invite code can access this single row. I am not sure if that is possible in Supabase, and if so, how to do it. In theory it should work by having the invite code act as token that is checked by the RLS policies and those policies would deny access to rows with different invite codes.