© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
5 replies
gldanoob

Possible race condition when sharing Supabase client across users

Say I have something like this as a request handler of my server:
async def get_session_middleware(request: web.Request): 
  # Get tokens from cookies       
  await supabase.auth.set_session(access_token, refresh_token)
  user = await supabase.auth.get_user()
  return user
async def get_session_middleware(request: web.Request): 
  # Get tokens from cookies       
  await supabase.auth.set_session(access_token, refresh_token)
  user = await supabase.auth.get_user()
  return user

If two users send a request at the same time, is there a chance that one of them will get logged in as another user? What is a better way of handling this?
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

Supabase Realtime race condition
SupabaseSSupabase / help-and-questions
4y ago
Race condition in insert
SupabaseSSupabase / help-and-questions
6mo ago
Caching via Race Condition?
SupabaseSSupabase / help-and-questions
3y ago
Race condition with RLS
SupabaseSSupabase / help-and-questions
4y ago