MENG21 commited on
Commit
ec6b621
·
1 Parent(s): 785afca
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -180,13 +180,13 @@ def main():
180
 
181
  if st.button("Logout"):
182
  del st.session_state['credentials']
183
- st.rerun() # Changed from st.experimental_rerun() to st.rerun()
184
 
185
  # Function to handle OAuth callback
186
  def handle_callback():
187
  flow = create_flow()
188
  try:
189
- flow.fetch_token(code=st.experimental_get_query_params()["code"][0])
190
  credentials = flow.credentials
191
  st.session_state['credentials'] = credentials.to_json()
192
  logging.debug("Token fetch successful")
@@ -198,7 +198,7 @@ def handle_callback():
198
 
199
  if __name__ == '__main__':
200
  logging.debug("Starting the application")
201
- if 'code' in st.experimental_get_query_params():
202
  logging.debug("Authorization code found in query parameters")
203
  handle_callback()
204
  main()
 
180
 
181
  if st.button("Logout"):
182
  del st.session_state['credentials']
183
+ st.rerun()
184
 
185
  # Function to handle OAuth callback
186
  def handle_callback():
187
  flow = create_flow()
188
  try:
189
+ flow.fetch_token(code=st.query_params["code"])
190
  credentials = flow.credentials
191
  st.session_state['credentials'] = credentials.to_json()
192
  logging.debug("Token fetch successful")
 
198
 
199
  if __name__ == '__main__':
200
  logging.debug("Starting the application")
201
+ if 'code' in st.query_params:
202
  logging.debug("Authorization code found in query parameters")
203
  handle_callback()
204
  main()