Auth hooks enable us to modify the access token with custom claims to add Role-Based Access Control (RBAC) to our Supabase project. In this example we’re looking at a Next.js Slack Clone with different permission levels for users, moderators, and admins.
Read the docs: https://supabase.com/docs/guides/auth...
Find the code: https://github.com/supabase/supabase/...
Presented by Thor Schaeff (@thorwebdev https://go.thor.bio/x)
CHAPTERS:
00:00 Intro to custom JWT claims and RBAC
00:47 Demo of the Slack Clone example
02:27 Create tables for user roles and permissions
03:20 Using Auth hooks to modify the JWT
05:45 Enable the auth hook in Supabase
06:05 Enable the auth hook in local dev
06:40 Authorize based on user roles in RLS policies
08:18 Accessing user roles in your application
09:01 Outro
💻 Videos to watch next:
▶ • Fastest way to build a SaaS in 2024 -...
▶ • FASTEST way to get started with Next....
▶ • The missing pieces to your AI app (pg...
👇 Learn more about Supabase 👇
🕸 Website: https://supabase.com/
🏁 Get started: https://app.supabase.com/
📄 Docs: https://supabase.com/docs
🔔 Subscribe for more tutorials and feature updates from Supabase: / @supabase
📱 Connect with Us:
🐙 Github: https://github.com/supabase
💬 Discord: https://discord.supabase.com/
🐦 Twitter: / supabase
📸 Instagram (follow for memes): / supabasecom
ABOUT SUPABASE:
Supabase is the open source Firebase alternative. Supabase provides a full Postgres database for every project with pgvector, backups, realtime, and more. Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.
Build in a weekend, scale to millions.
#Supabase #AppDevelopment #RealtimeApps #DeveloperTools