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 gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.