MENG21 commited on
Commit
59c8da9
·
1 Parent(s): 8e2b0d5
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -177,7 +177,9 @@ def main():
177
  # Function to handle OAuth callback
178
  def handle_callback():
179
  flow = create_flow()
180
- flow.fetch_token(code=st.query_params["code"])
 
 
181
  credentials = flow.credentials
182
  st.session_state['credentials'] = credentials.to_json()
183
  return credentials
 
177
  # Function to handle OAuth callback
178
  def handle_callback():
179
  flow = create_flow()
180
+ code = st.experimental_get_query_params().get("code", [None])[0]
181
+ if code:
182
+ flow.fetch_token(code=code)
183
  credentials = flow.credentials
184
  st.session_state['credentials'] = credentials.to_json()
185
  return credentials