feat(examples): organization multi-tenancy in react-neon-js - #149
Open
Shridhad wants to merge 3 commits into
Open
feat(examples): organization multi-tenancy in react-neon-js#149Shridhad wants to merge 3 commits into
Shridhad wants to merge 3 commits into
Conversation
Demonstrate Neon Auth JWT claim `o` for org-scoped RLS alongside personal todos, with auth-ui OrganizationSwitcher and organization management routes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add SECURITY DEFINER to jwt_organization() in all three migration files; without it authenticated role gets permission denied on auth schema - Fix invalid DROP FUNCTION ... ->> 'id' syntax in incremental migrations - Add /account/organizations view to AccountPage; OrganizationView unconditionally redirects there when no active org, leaving a dead page - Replace hooks.useActiveMember() with activeOrg.members lookup; useActiveMember is not on the exported AuthHooks type, causing TS build failure Co-authored-by: Isaac
After switching active organization the JWT with the stale `o` claim remained cached for up to 15 minutes (full JWT TTL), causing every team-scoped Data API request to 403 until expiry. Intercept /organization/set-active and call invalidateSessionCache() on success, consistent with the existing signOut pattern. Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/react-neon-jswith Neon Auth Organizations plugin:OrganizationSwitcher,/organization/:pathnameroutes, andorganization={{}}onNeonAuthUIProvider.o(public.jwt_organization() ->> 'id') plus personal todos (organization_id IS NULL).migration-organization.sql,migration-personal-todos.sql) for existing databases.Test plan
migration.sql(new DB) ormigration-organization.sql+migration-personal-todos.sql(existing)pnpm run buildand E2E against example (pnpm run --filter e2e test:ci) when credentials available