Spaces:
Sleeping
Sleeping
app.py
CHANGED
|
@@ -180,13 +180,13 @@ def 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.
|
| 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.
|
| 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()
|