JWT-update_2
Browse files
app.py
CHANGED
|
@@ -149,25 +149,12 @@ def plaid_exchange_token(
|
|
| 149 |
raise HTTPException(status_code=401, detail="Unauthorized")
|
| 150 |
try:
|
| 151 |
access_token = exchange_public_token(request.public_token)
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
resp = requests.post(
|
| 155 |
-
f"{SUPABASE_URL}/functions/v1/save-bank-token",
|
| 156 |
-
headers={
|
| 157 |
-
"Authorization": f"Bearer {credentials.credentials}",
|
| 158 |
-
"Content-Type": "application/json"
|
| 159 |
-
},
|
| 160 |
-
json={
|
| 161 |
-
"access_token": access_token,
|
| 162 |
-
"institution_name": "Connected Bank"
|
| 163 |
-
}
|
| 164 |
-
)
|
| 165 |
-
print(f"Save bank token: {resp.status_code} {resp.text}")
|
| 166 |
-
|
| 167 |
-
return {"status": "connected"}
|
| 168 |
except Exception as e:
|
| 169 |
print(f"Exchange token error: {e}")
|
| 170 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 171 |
|
| 172 |
@app.delete("/account")
|
| 173 |
def delete_account(
|
|
|
|
| 149 |
raise HTTPException(status_code=401, detail="Unauthorized")
|
| 150 |
try:
|
| 151 |
access_token = exchange_public_token(request.public_token)
|
| 152 |
+
# Return access_token to app — app will save it directly
|
| 153 |
+
return {"status": "connected", "access_token": access_token}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
except Exception as e:
|
| 155 |
print(f"Exchange token error: {e}")
|
| 156 |
raise HTTPException(status_code=500, detail=str(e))
|
| 157 |
+
|
| 158 |
|
| 159 |
@app.delete("/account")
|
| 160 |
def delete_account(
|