Hi there
I’m having an issue getting a cookie set for https://deepdeepsheet.com/ (in production, localhost works fine)
If you visit that url you will be asked to log in using either Facebook or Google. The login flow works fine and FB or Google redirects to a lambda function:
https://deepdeepsheet.com/.netlify/functions/authReturn (the FB one)
https://deepdeepsheet.com/.netlify/functions/authReturnGoogle (the google one)
when FB/Google does the redirect they add some query parameters like ?code=blahblah&state=foo …but I don’t think that is important here
Those functions then do a 302 redirect that looks like this:
{
statusCode: 302,
headers: {
‘Location’: ‘https://deepdeepsheet.com’, // in the real code this comes from an environment variable
‘Access-Control-Expose-Headers’: ‘Set-Cookie’,
‘Set-Cookie’: cookie,
},
};
(I have been messing with this and trying various options)
The issue is getting the cookie set on the browser. In the network tab I can see two entries:
…this one is what I’m expecting…Response Headers contains my set-cookie for deepdeepsheet:
set-cookie: deepdeepsheet=I_ffcb9df4125f9eabc8639eff_S_6001c03542315d0008e85f9f; Max-Age=2592000; Secure
and Request Headers shows the deepdeepsheet cookie also:
cookie: deepdeepsheet=I_ffcb9df4125f9eabc8639eff_S_6001c03542315d0008e85f9f; G_ENABLED_IDPS=google; G_AUTHUSER_H=0
…but immediately below that entry in the Network tab I get this:
Request URL: Deep Deep Sheet
where the Request Headers have no set-cookie entry and the Response Headers show the cookies but without my deepdeepsheet one included:
cookie: G_ENABLED_IDPS=google; G_AUTHUSER_H=0
…I hope that is clear enough…
So what I’m trying to figure out is where that 2nd call is coming from - it seems to be overwriting my cookie.
Any clues/ideas you could give would be appreciated!
Thanks!
Simon