Issue with Extracting HTTP Cookies for Google Login and Logout Functionality - Video Attached
Hey guys,
I am encountering an issue with extracting HTTP cookies within my Windmill app. I've attached a short video demonstrating the problem:
Successful Google Login: As you can see in the video at [00:00:00 - 00:00:22], the "Sign in With Google" functionality is working correctly. Upon successful authentication, the application sets an HTTP-only cookie named sharpesense_session_id in the browser. This cookie is visible in the browser's developer tools under the "Application" tab, as shown in the video.
Logout Implementation Issue (00:00:23 - 00:00:40): I am now trying to implement a logout feature. The goal is to invalidate the sharpesense_session_id cookie on the backend when the user clicks "Logout". To achieve this, I need to extract the sharpesense_session_id cookie from the request sent to my backend logout route.
Problem: No Cookies Found in Logout Request (00:00:25 - 00:00:40): However, as demonstrated in the video, when I trigger the logout route, the backend function reports "No cookies found in the request." despite the cookie being present in the browser and expected to be sent with the request.
What I've Tried (code snippet in video 00:00:44 - 00:00:48):
In my Windmill Python script for the logout route, I'm attempting to extract the cookie from the request headers. The code, which I will share as a file
The sharpesense_session_id cookie is correctly set by the login process.
The cookie should be sent with the request to the /logout route.
However, my backend logic in Windmill (as shown in the video) is unable to extract the cookie from the request headers, and I receive the "No cookies found in the request." message.
Could you please provide guidance on how to correctly extract an HTTP-only cookie like sharpesense_session_id from the browser request within a Windmill backend script? I need to access this cookie to properly implement the logout functionality.
Thank you for your time and assistance.
5 Replies
Here is my backend code
scripts are executed in the backend and they're not passed the cookies/headers unless you use a preprocessor to extract that part
@Hugo do we have a link in the docs for header processing?
Custom HTTP routes | Windmill
Windmill supports custom HTTP routes to trigger runnables or serve static assets and websites.
Thank you for your help guys I was able to do it properly 🙂 Here is the script in python that works for reference