AlphaAngel444 commited on
Commit
50d0b90
·
verified ·
1 Parent(s): 19df612

Add Google Auth Feature

Browse files

Add Google Authentication Feature

Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -17,6 +17,13 @@ PINECONE_ENV = os.getenv("PINECONE_ENV")
17
  HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
18
  USER_ID = "demo_user" # static user for testing
19
 
 
 
 
 
 
 
 
20
  # === Firebase Setup ===
21
  if not firebase_admin._apps:
22
  cred = credentials.Certificate("service-account-key.json")
 
17
  HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
18
  USER_ID = "demo_user" # static user for testing
19
 
20
+ # === Require Authentication ===
21
+ if "user" not in st.session_state or "email" not in st.session_state["user"]:
22
+ st.error("Please sign in with your Google account to access the Clinical Trial Discovery tool.")
23
+ st.stop()
24
+
25
+ USER_ID = st.session_state["user"]["email"] # use email as unique user ID
26
+
27
  # === Firebase Setup ===
28
  if not firebase_admin._apps:
29
  cred = credentials.Certificate("service-account-key.json")