T7yrttrd commited on
Commit
61e0ce9
·
verified ·
1 Parent(s): b5e2978

Update routes_auth.py

Browse files
Files changed (1) hide show
  1. routes_auth.py +5 -6
routes_auth.py CHANGED
@@ -73,7 +73,7 @@ async def auth_callback(request: Request):
73
  "code": code,
74
  "redirect_uri": REDIRECT_URI
75
  }
76
- async with httpx.AsyncClient() as client:
77
  res = await client.post(token_url, json=payload, headers=headers)
78
  token_data = res.json()
79
  elif service == "canva":
@@ -95,7 +95,7 @@ async def auth_callback(request: Request):
95
  }
96
  if code_verifier:
97
  payload["code_verifier"] = code_verifier
98
- async with httpx.AsyncClient() as client:
99
  res = await client.post(token_url, data=payload, headers=headers)
100
  token_data = res.json()
101
  elif service == "microsoft":
@@ -108,7 +108,7 @@ async def auth_callback(request: Request):
108
  "scope": cfg["scope"]
109
  }
110
  headers = {"Content-Type": "application/x-www-form-urlencoded"}
111
- async with httpx.AsyncClient() as client:
112
  res = await client.post(token_url, data=payload, headers=headers)
113
  token_data = res.json()
114
  elif service == "vercel":
@@ -120,7 +120,7 @@ async def auth_callback(request: Request):
120
  "redirect_uri": REDIRECT_URI
121
  }
122
  headers = {"Content-Type": "application/x-www-form-urlencoded"}
123
- async with httpx.AsyncClient() as client:
124
  res = await client.post(token_url, data=payload, headers=headers)
125
  token_data = res.json()
126
  else:
@@ -132,8 +132,7 @@ async def auth_callback(request: Request):
132
  "redirect_uri": REDIRECT_URI
133
  }
134
  headers = {"Accept": "application/json"}
135
-
136
- async with httpx.AsyncClient() as client:
137
  res = await client.post(token_url, data=payload, headers=headers)
138
  token_data = res.json()
139
 
 
73
  "code": code,
74
  "redirect_uri": REDIRECT_URI
75
  }
76
+ async with httpx.AsyncClient(timeout=30.0) as client:
77
  res = await client.post(token_url, json=payload, headers=headers)
78
  token_data = res.json()
79
  elif service == "canva":
 
95
  }
96
  if code_verifier:
97
  payload["code_verifier"] = code_verifier
98
+ async with httpx.AsyncClient(timeout=30.0) as client:
99
  res = await client.post(token_url, data=payload, headers=headers)
100
  token_data = res.json()
101
  elif service == "microsoft":
 
108
  "scope": cfg["scope"]
109
  }
110
  headers = {"Content-Type": "application/x-www-form-urlencoded"}
111
+ async with httpx.AsyncClient(timeout=30.0) as client:
112
  res = await client.post(token_url, data=payload, headers=headers)
113
  token_data = res.json()
114
  elif service == "vercel":
 
120
  "redirect_uri": REDIRECT_URI
121
  }
122
  headers = {"Content-Type": "application/x-www-form-urlencoded"}
123
+ async with httpx.AsyncClient(timeout=30.0) as client:
124
  res = await client.post(token_url, data=payload, headers=headers)
125
  token_data = res.json()
126
  else:
 
132
  "redirect_uri": REDIRECT_URI
133
  }
134
  headers = {"Accept": "application/json"}
135
+ async with httpx.AsyncClient(timeout=30.0) as client:
 
136
  res = await client.post(token_url, data=payload, headers=headers)
137
  token_data = res.json()
138