-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Samesite Lax cookie not being set #47
Comments
I had the same issue and to make it work I had to set The annoying thing is that I have to keep alternating between the cookie settings |
This is driving me nuts! I downgraded both [node-]redis and connect-redis to the versions Ben uses, wondering if that might help. Nope. My cookies are being saved in my redis db at the |
Did you check that the cookie is actually saved in the browser? express-session shouldn't be creating a new session on every request if there is already a cookie attached. |
Yep. Cookie is saved in the browser. |
Just cloned this repo and created a fresh database to test. Checked out the So... what am I missing? I have |
@brimarq If it was a CORS issue, I believe the request would fail before any session is created. Have you tried to run the requests from the frontend instead? I actually had a lot of issues while testing the cookies because with the latest versions of Apollo, the GraphQL playground is executing from an external site (Apollo Studio) instead of locally, and I needed to use different configurations depending on whether I was doing the requests from my frontend or from Apollo Studio. Feel free to check out my repo if it's any help, I recently started the project so I'm using the latest versions of most packages. |
@vgarmes Interesting... on a whim, I just tried again with @benawad 's repo, sending my req with Insomnia, and it works! I didn't want to fool with the new Apollo Studio for the reason you mentioned - because it routes requests to an external site; and, I was frustrated with Altair GraphQL Client trying to |
@brimarq nice! I will definitely give Insomnia a try, I've heard good stuff about it. |
@brimarq I'm curious what was the frustration you had with Altair and sending credentials? 🤔 |
Oops... correction... I could send credentials ok, I just couldn't find the cookie. Just checked again this evening and I see it now. I had been looking in the dev tools "Application" tab under Storage -> Cookies, as in Ben's GraphQL Playground example, and it never shows up there. In Altair, the cookie appears in the "Network" tab. In my frustration last night, I completely missed that. Clearly, I should take more frequent breaks. LOL In Insomnia, the cookie has it's own dedicated tab in the response pane such that you can't miss it. |
I've tried literally everything on this thread and even googled the shit out of myself but this doesn't seem to work, when I run the query I never get the sessions in the application tab, all I get is this This is my code -> https://github.com/Deveshb15/redemon |
@Deveshb15 did you also set Apollo Studio's default headers to |
What I did to address this was set the same headers when creating the URQL client in const client = createClient({
url: "http://localhost:4000/graphql",
fetchOptions: {
credentials: "include",
headers: { "X-Forwarded-Proto": "https" },
},
}); |
This worked for me, thank you for sharing. |
I had a similar issue, I was wrongly setting the cookie options in session middleware. secure: false |
When running the login test with ApolloGraphQL; the request works fine. However, the cookie is not being set because the browser is blocking the cookie from being set due to SameSite=Lax.
Can anyone offer any guidance on how to get the cookie to be set. I have configured cors to work with the apollographql query studio:
Here is my session configuration:
Any help is greatly appreciated.
The text was updated successfully, but these errors were encountered: