Spaces:
Runtime error
Runtime error
Debugging the failed case
Browse files- app.py +1 -0
- token_store.py +2 -2
app.py
CHANGED
|
@@ -43,6 +43,7 @@ async def oauth_callback(code: str = "", state: str = ""):
|
|
| 43 |
Mount at /oauth/callback in your Space.
|
| 44 |
"""
|
| 45 |
result = handle_oauth_callback(code, state)
|
|
|
|
| 46 |
if result["success"]:
|
| 47 |
return {
|
| 48 |
"status": "success",
|
|
|
|
| 43 |
Mount at /oauth/callback in your Space.
|
| 44 |
"""
|
| 45 |
result = handle_oauth_callback(code, state)
|
| 46 |
+
print(f">>> OAuth result: {result}")
|
| 47 |
if result["success"]:
|
| 48 |
return {
|
| 49 |
"status": "success",
|
token_store.py
CHANGED
|
@@ -37,13 +37,13 @@ def save_token(user_email: str, token_dict: dict) -> None:
|
|
| 37 |
Upserts (insert or update) the Google OAuth token for the user.
|
| 38 |
"""
|
| 39 |
client = _get_client()
|
| 40 |
-
client.table(TABLE).upsert(
|
| 41 |
{
|
| 42 |
"user_email": user_email,
|
| 43 |
"token_json": json.dumps(token_dict),
|
| 44 |
}
|
| 45 |
).execute()
|
| 46 |
-
|
| 47 |
|
| 48 |
def delete_token(user_email: str) -> None:
|
| 49 |
"""
|
|
|
|
| 37 |
Upserts (insert or update) the Google OAuth token for the user.
|
| 38 |
"""
|
| 39 |
client = _get_client()
|
| 40 |
+
response =client.table(TABLE).upsert(
|
| 41 |
{
|
| 42 |
"user_email": user_email,
|
| 43 |
"token_json": json.dumps(token_dict),
|
| 44 |
}
|
| 45 |
).execute()
|
| 46 |
+
print(f">>> Token saved for {user_email}: {response.data}")
|
| 47 |
|
| 48 |
def delete_token(user_email: str) -> None:
|
| 49 |
"""
|