© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
Infrapuna

Security implications of auth.setAuth

Context: I am toying with a role-based authorization system. The authorization works as a database function that calls auth.uid to get current user and look at all the permissions their role grants.

Now the problem: the database function can be called with rpc from my backend but since I don't want to expose users permissions to anyone calling, the function uses auth.uid to only return the caller their permissions. Of course if I am calling it from server-side I don't have a user and the function returns no permissions.

I can use auth.setAuth to set the caller as the user calling my API based on cookies. Are there security implications with this? For example could repeated calls be used to gain access as a different user than your are.
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

Server auth without setAuth
SupabaseSSupabase / help-and-questions
4y ago
Please bring `auth.setAuth` back
SupabaseSSupabase / help-and-questions
4y ago
Row Level Security for custom auth?
SupabaseSSupabase / help-and-questions
4y ago
supabase.auth.setAuth(token) deprecated, docs deleted, no way to find alternative
SupabaseSSupabase / help-and-questions
4y ago