Skip to content

Commit

Permalink
Fixed?
Browse files Browse the repository at this point in the history
  • Loading branch information
elsong86 committed Nov 9, 2024
1 parent 688b34e commit 0a857c4
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions backend/app/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,17 @@ async def signin(user_details: UserCreate, response: Response, db_service: Datab

jwt_token = result["access_token"]
response.set_cookie(
key="access_token",
value=jwt_token,
httponly=True,
secure=True,
samesite="None",
max_age=3600,
path="/", # Ensure this is set to root
domain="tacoaboutit.app" # Specify domain if applicable
)
key="access_token",
value=jwt_token,
httponly=True,
secure=True, # Ensure HTTPS is used
samesite="None", # Or "Lax" for testing
max_age=3600
)
return {"message": "Signin successful"}

@router.post("/logout")
async def logout(response: Response):
# Clear the cookie by setting an expired max_age
response.delete_cookie(key="access_token", path="/", httponly=True)
return {"message": "Logged out successfully"}

@router.get("/set-test-cookie")
async def set_test_cookie(response: Response):
response.set_cookie(
key="test_cookie",
value="test_value",
httponly=True,
secure=True,
samesite="None",
max_age=3600,
path="/"
)
return {"message": "Test cookie set"}

0 comments on commit 0a857c4

Please sign in to comment.