Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +8 -5
app/main.py
CHANGED
|
@@ -123,12 +123,9 @@ def oauth2callback(request: Request):
|
|
| 123 |
if not code:
|
| 124 |
return HTMLResponse("Erro: c贸digo OAuth n茫o recebido.", status_code=400)
|
| 125 |
|
| 126 |
-
flow = build_flow(
|
| 127 |
-
state=OAUTH_TEMP.get("state"),
|
| 128 |
-
code_verifier=OAUTH_TEMP.get("code_verifier"),
|
| 129 |
-
)
|
| 130 |
-
|
| 131 |
flow.fetch_token(code=code)
|
|
|
|
| 132 |
save_credentials(flow.credentials)
|
| 133 |
|
| 134 |
return HTMLResponse("""
|
|
@@ -136,6 +133,12 @@ def oauth2callback(request: Request):
|
|
| 136 |
<p>Agora o backend pode salvar feedbacks na planilha.</p>
|
| 137 |
""")
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
except Exception as e:
|
| 140 |
return HTMLResponse(
|
| 141 |
f"<h2>Erro no OAuth callback</h2><pre>{type(e).__name__}: {str(e)}</pre>",
|
|
|
|
| 123 |
if not code:
|
| 124 |
return HTMLResponse("Erro: c贸digo OAuth n茫o recebido.", status_code=400)
|
| 125 |
|
| 126 |
+
flow = build_flow()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
flow.fetch_token(code=code)
|
| 128 |
+
|
| 129 |
save_credentials(flow.credentials)
|
| 130 |
|
| 131 |
return HTMLResponse("""
|
|
|
|
| 133 |
<p>Agora o backend pode salvar feedbacks na planilha.</p>
|
| 134 |
""")
|
| 135 |
|
| 136 |
+
except Exception as e:
|
| 137 |
+
return HTMLResponse(
|
| 138 |
+
f"<pre>{type(e).__name__}: {str(e)}</pre>",
|
| 139 |
+
status_code=500
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
except Exception as e:
|
| 143 |
return HTMLResponse(
|
| 144 |
f"<h2>Erro no OAuth callback</h2><pre>{type(e).__name__}: {str(e)}</pre>",
|