Skip to content

Commit

Permalink
Cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Oct 4, 2024
1 parent 71e5dcc commit a285556
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions images/dashboard/src/routes/login_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def initialize_session(request: Request, box: str = Query(...), end_redirect_uri
}
)
# Set cookie_id with session_id
response.set_cookie(key="cookie_id", value=session_id, max_age=120)
response.set_cookie(key="cookie_id", value=session_id, max_age=120, domain="dashboard.osmsandbox.us")
logging.info("Generated new cookie_id and saved to database")
return response

Expand Down Expand Up @@ -137,7 +137,9 @@ async def redirect_sandbox(request: Request, code: str, db: Session = Depends(ge
end_redirect_uri = f"https://{box}.{domain}/login?user={user}"

logging.info(f"Redirecting to URL: {end_redirect_uri}")
return RedirectResponse(url=end_redirect_uri)
response = RedirectResponse(url=end_redirect_uri)
response.delete_cookie("cookie_id")
return response
else:
logging.error("Cookie ID not found")
raise HTTPException(status_code=404, detail="Check if instance exists")
Expand Down

0 comments on commit a285556

Please sign in to comment.