Multiple Sessions Issue with Supabase Auth

Multiple Sessions Issue with Supabase Auth

Hey Streamlit team, thanks for all of the great work!

Iโ€™m attempting to add authentication using supabase according to the docs here, but I seem to be missing something.

When a user logs in on their session, that session is persisted across all other users. Two different users canโ€™t be logged in at the same time. And any visitor is automatically authenticated if someone else is logged in.

I believe the problem comes from this line of code here:

if supabase.auth.get_user():

This returns the latest user across all sessions, not necessarily the active userโ€™s session.

Loom Demo Video:
Problem Explanation Video

Example App URL:
https://supabase-test.streamlit.app

GitHub Repo:
https://github.com/CBell045/Test

Streamlit Version: streamlit==1.28.2
Python 11

Thanks for your help on this!