Next.js Server Component role base access with Supabase

  Рет қаралды 17,829

Daily Web Coding

Daily Web Coding

Күн бұрын

In this video I am going to show you how to do Role base access with Supabase and Next.js Server Component.
Code
github.com/Che...
Doc and tutorial
dev.to/sruhled...
• Implement Authorizatio... ‪@Supabase‬
Support the channel : 🙏🌸
donate 🌻: / dailywebcoding
Follow me: 👇
Discord: / discord
Github: github.com/Che...

Пікірлер: 51
@DailyWebCoding
@DailyWebCoding Жыл бұрын
I think supabase just updated the UI. right now you can do it in the sql editor and create the trigger from there by using this command. create trigger after insert on auth.users for each row execute function ();
@markbroomfield1818
@markbroomfield1818 Жыл бұрын
Apologises for being thick but could you tell me where I need to add this code? Thank you again for your help, Mark
@DailyWebCoding
@DailyWebCoding Жыл бұрын
@@markbroomfield1818 In supabase dashboard sidebar. You can find SQL Editor. That's where you can run the code above
@markbroomfield1818
@markbroomfield1818 Жыл бұрын
@@DailyWebCoding Apologies, I understand it needs to be added to the SQL Editor. However, does it need to be attached to anything else or just a seperate code and run? Thanks Mark
@DailyWebCoding
@DailyWebCoding Жыл бұрын
@@markbroomfield1818 kzbin.info/www/bejne/o5TVoqFtbNGIo68si=GiVaHvcrioXb9bZY you can check this video. Hope is can help you
@markbroomfield1818
@markbroomfield1818 Жыл бұрын
@@DailyWebCoding Thank you so much for the quick work around on this. Works a treat, great channel and please keep up the amazing work. Thanks Mark
@FalconMasters
@FalconMasters 10 ай бұрын
There is one security problem with that aproach that you all guys have to be aware of. If you make a "user" or "profile" table where you store all the user info like, name, avatar, settings, etc and you store the role on that same table you have a security issue there. Because you will probably make a Row Level Security where you are going to allow users edit their own row in "user" table, therefore the user will have access to change his own role to "admin". To solve this you have to add the "role" column on a different table and that table should have a Row Level Security that only allows to read and not to write/update.
@guillermomarindavila5779
@guillermomarindavila5779 10 ай бұрын
gracias falcon, aprendi mucho de ti en un inicio y vaya sorpresa con el comentario, tienes razon!
@FalconMasters
@FalconMasters 10 ай бұрын
@@guillermomarindavila5779 Muchas gracias a ti por ver mis videos, me alegra que te sirvieran!
@Sirin-i8j
@Sirin-i8j 3 ай бұрын
thnx
@petrecosminbadescu6161
@petrecosminbadescu6161 20 күн бұрын
I think you can also freeze the column, creating a policy for it
@codewithguillaume
@codewithguillaume Жыл бұрын
Amazing video :) Please continue !
@DailyWebCoding
@DailyWebCoding Жыл бұрын
Thank you ❤️
@kryptons-galaxy
@kryptons-galaxy 7 ай бұрын
Perfect tutorial, I was confused with managing the user accesses, this one cleared all the doubts, thanks ❤
@DailyWebCoding
@DailyWebCoding 7 ай бұрын
Glad it helped!
@dimitarius4137
@dimitarius4137 Ай бұрын
Thank you, this was actually all I was looking for, perfect tutorial, thank you so much!!
@matteoperonidev
@matteoperonidev 20 күн бұрын
Thanks man, you saved my life ❤
@codingcode69
@codingcode69 4 күн бұрын
What font and vs code settings you have it looks super clean is there a link to your settings 😅
@cheninh1423
@cheninh1423 Жыл бұрын
so clearly. thank you
@giroda
@giroda Жыл бұрын
nice video and nice line-height
@streamocu2929
@streamocu2929 Жыл бұрын
we want more... ❤ could you do supabase and stripe?
@DailyWebCoding
@DailyWebCoding Жыл бұрын
I will look into that. Thank you for your suggestion.
@automioai
@automioai Жыл бұрын
Yes! stripe-supa -next 13.4-jotai
@brianwalsh7040
@brianwalsh7040 Жыл бұрын
Great videos, thanks! Could you do one where anyone visiting the site can view the all the posts, but only an admin can update the posts that belong to them?
@DailyWebCoding
@DailyWebCoding Жыл бұрын
Thank you for your suggestion. I will try to do that.
@appstuff6565
@appstuff6565 Жыл бұрын
yes pleaSE ! @@DailyWebCoding
@markbroomfield1818
@markbroomfield1818 Жыл бұрын
Hello, great tutorial 👍 ! Everything was going fine until when I needed to select the auth table (timestamp 06:23) in the trigger ui. Only my public tables were available and not anything else! Is there a reason why I can't make triggers from any of the locked shemas? Can you help. Thanks, Mark
@raynosebastian6275
@raynosebastian6275 Жыл бұрын
currently facing the same thing right now, did you find the solution?
@DailyWebCoding
@DailyWebCoding Жыл бұрын
I think supabase just updated the UI. right now you can do it in the sql editor and create the trigger from there by using this command. create trigger after insert on auth.users for each row execute function ();
@angelluis5252
@angelluis5252 11 ай бұрын
nice video, i have a qustion, how can i change the role using params? i need create multiples roles
@DailyWebCoding
@DailyWebCoding 11 ай бұрын
Currently I am working on a new video about this as well. Stay tuned for that
@raynosebastian6275
@raynosebastian6275 Жыл бұрын
hi a beginner here, why i cant choose the users from the trigger option right now ?
@DailyWebCoding
@DailyWebCoding Жыл бұрын
I think supabase just updated the UI. right now you can do it in the sql editor and create the trigger from there by using this command. create trigger after insert on auth.users for each row execute function ();
@DeejayAlid
@DeejayAlid Жыл бұрын
Are there any security flaws using this method?
@FalconMasters
@FalconMasters 10 ай бұрын
Yes, that if you make a row level security that allows the user to update his profile or user info and is on the same table as the rol then he has access to update his role and set it to "admin" giving him self permissions. One way to fix this is to have 2 diferent tables for the user, one for his data and other one for his role or permissions.
@user-dm5qi4nb6l
@user-dm5qi4nb6l 11 ай бұрын
Supabase has a roles column in auth.users I tried to use that but maybe that is not how it is supposed to be used maybe that's only there to be managed for supabase? I created a custom role give it to a user but then when I made the rule it was simply not working, of course I gave the user in auth.users that custom role but then I had to change it back to authenticated then update the rule and it worked normally.
@DailyWebCoding
@DailyWebCoding 11 ай бұрын
You can check my latest video about role management in supabase Build Role Access Dashboard with Next.js 14,Supabase, Shadcn,Tailwind kzbin.info/www/bejne/emilq6OsfbJpgKs
@Michael-Martell
@Michael-Martell Жыл бұрын
I think a regional manager with several managers with several teams. Managers should only see their teams… etc. I’ve been thinking about how to make this works for several years now as I have learned to code.
@ambicasupraja9651
@ambicasupraja9651 10 ай бұрын
i am getting this error while sign up AuthApiError: duplicate key value violates unique constraint "user_pkey" as i am created trigger from sql editor
@utomoyogafirmansyah7912
@utomoyogafirmansyah7912 Жыл бұрын
But how to set role while we signup not with supabase?
@rgorai1029
@rgorai1029 9 ай бұрын
I need this too 😭 did you ever figure it out?
@utomoyogafirmansyah7912
@utomoyogafirmansyah7912 9 ай бұрын
@@rgorai1029 yeah i make another table that containing userprofile and role and after signup an get token user need to set his role
@thisismedg
@thisismedg 9 ай бұрын
@@rgorai1029 me too
@loribryant4999
@loribryant4999 8 ай бұрын
sir can you create a react version of this please I dont understang nextJS
@loribryant4999
@loribryant4999 8 ай бұрын
hey bro can you updated this please I need this and the role please dont just put the role in it manuall make it dynamic, also please take it slow man you kind super fast
@DailyWebCoding
@DailyWebCoding 8 ай бұрын
Build Role Access Dashboard with Next.js 14,Supabase, Shadcn,Tailwind kzbin.info/www/bejne/emilq6OsfbJpgKs
@DailyWebCoding
@DailyWebCoding 8 ай бұрын
You can check this one
@loribryant4999
@loribryant4999 8 ай бұрын
@@DailyWebCoding thank you sir, are you able to create a video like this with reactJS alone please
@ahmedmusawir
@ahmedmusawir 2 ай бұрын
Your head is covering code ... we really didn't need to see your face ... we just needed to see code which we couldn't for your head which makes this video useless ...
Supabase does not cache inside Next.js server component.?
13:12
Daily Web Coding
Рет қаралды 2,8 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 9 МЛН
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 25 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 262 #shorts
00:20
"The Life & Death of htmx" by Alexander Petros at Big Sky Dev Con 2024
23:01
Montana Programmers
Рет қаралды 65 М.
Handling user data in Supabase
17:05
WeWeb
Рет қаралды 7 М.
The BEST way to host Next.js websites
17:37
ByteGrad
Рет қаралды 52 М.
The Big Headless CMS Lie (James Mikrut)
18:14
Vercel
Рет қаралды 64 М.
Understand the Supabase SSR Package easily
13:55
activenode
Рет қаралды 12 М.
Supabase and NextJS 14:  Auth and Server Actions
1:19:31
Jolly Coding
Рет қаралды 22 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 9 МЛН