© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
1 reply
Quick

understanding service_role key

I am unsure weather i should use service_role key or not, my use case is that there is a table
public.user_balance
public.user_balance
which stores the user balance and the corresponding id to that user.

and another table
public.balance_cards
public.balance_cards
which stores a value and a uuid.

the functionality i want to achieve is, an authenticated user sends a uuid if the uuid matches an available uuid from
balance_cards
balance_cards
the value in that row should be added to the users's balance in
public.user_balance
public.user_balance
and deleted as well, so the user cant use the same row to recharge their account many times.


Someone suggested me to use service_role for this use case and said its more secure.

I want to know what is your approaches and if i can use the database to achieve this securely without needing service_role.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

JWT Service Role Key
SupabaseSSupabase / help-and-questions
3d ago
Hiding Service Role Key
SupabaseSSupabase / help-and-questions
4y ago
inviteUserByEmail Service_Role_Key
SupabaseSSupabase / help-and-questions
4y ago
rotate legacy service role key?
SupabaseSSupabase / help-and-questions
4mo ago