Spaces:
Sleeping
Sleeping
app.py
CHANGED
|
@@ -172,18 +172,18 @@ def main():
|
|
| 172 |
|
| 173 |
if st.button("Logout"):
|
| 174 |
del st.session_state['credentials']
|
| 175 |
-
st.
|
| 176 |
|
| 177 |
# Function to handle OAuth callback
|
| 178 |
def handle_callback():
|
| 179 |
flow = create_flow()
|
| 180 |
-
flow.fetch_token(code=st.
|
| 181 |
credentials = flow.credentials
|
| 182 |
st.session_state['credentials'] = credentials.to_json()
|
| 183 |
return credentials
|
| 184 |
|
| 185 |
if __name__ == '__main__':
|
| 186 |
-
if 'code' in st.
|
| 187 |
handle_callback()
|
| 188 |
-
st.
|
| 189 |
main()
|
|
|
|
| 172 |
|
| 173 |
if st.button("Logout"):
|
| 174 |
del st.session_state['credentials']
|
| 175 |
+
st.rerun()
|
| 176 |
|
| 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
|
| 184 |
|
| 185 |
if __name__ == '__main__':
|
| 186 |
+
if 'code' in st.query_params:
|
| 187 |
handle_callback()
|
| 188 |
+
st.rerun()
|
| 189 |
main()
|