Spaces:
Running
Running
Update test.py
Browse files
test.py
CHANGED
@@ -36,9 +36,15 @@ async def login_google():
|
|
36 |
}
|
37 |
|
38 |
@app.post("/auth/google")
|
39 |
-
async def auth_google(code: str):
|
40 |
#This code is basically the authorization code and this authorization code helps us to get the access token with the required scopes that we have set .
|
41 |
#We require the gmail.readonly scopes that requires verification of our application and all.
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
token_url = "https://accounts.google.com/o/oauth2/token"
|
43 |
print(code)
|
44 |
data = {
|
|
|
36 |
}
|
37 |
|
38 |
@app.post("/auth/google")
|
39 |
+
async def auth_google(request: Request,code: str):
|
40 |
#This code is basically the authorization code and this authorization code helps us to get the access token with the required scopes that we have set .
|
41 |
#We require the gmail.readonly scopes that requires verification of our application and all.
|
42 |
+
data = await request.json()
|
43 |
+
code = data.get("access_token")
|
44 |
+
|
45 |
+
if not code:
|
46 |
+
raise HTTPException(status_code=400, detail="Authorization code not provided")
|
47 |
+
|
48 |
token_url = "https://accounts.google.com/o/oauth2/token"
|
49 |
print(code)
|
50 |
data = {
|