Update main.py
Browse files
main.py
CHANGED
@@ -154,7 +154,11 @@ async def verify_google_token(token_data: TokenData, db: Session = Depends(get_d
|
|
154 |
)
|
155 |
|
156 |
# Redirect the user to the protected route
|
157 |
-
|
|
|
|
|
|
|
|
|
158 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
159 |
return response
|
160 |
# Dependency for verifying the user's token
|
|
|
154 |
)
|
155 |
|
156 |
# Redirect the user to the protected route
|
157 |
+
# response = RedirectResponse(url="/protected")
|
158 |
+
# response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
159 |
+
url = app.url_path_for("get_protected") # Ensure you have a name="get_protected" in your app.get("/protected") decorator
|
160 |
+
|
161 |
+
response = RedirectResponse(f"{url}?token={access_token}", status_code=status.HTTP_303_SEE_OTHER)
|
162 |
response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
|
163 |
return response
|
164 |
# Dependency for verifying the user's token
|