-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Request cookies not being passed when same-origin
is set.
#2443
Comments
Decided to look at the source code to see whats wrong, the documentation is incorrect for passing options. You don't need to pass the credentials in an
Should actually read:
|
Docs were off: #2462 |
still not working for me, even setting |
Opened issue a couple days ago, looked at code today to see if I could fix, turned out to be a simple docs error: #2443 `credentials` should not be nested inside `opts`, this does not work. It needs to be on the top level of the object.
Any update on this? |
In some docs. it says to use HttpLink : Here is what I have.
|
I was able to get it to work after I upgraded my dependencies:
|
I've upgraded my dependencies to what @francisngo has👆, but still not getting this to work. This is a really strange issue. |
I moved to same-origin will check scheme, hostname and port. After switching to 'include' I also had to fix up my CORS. |
Having the same issue. Cannot pass cookies. @chriskolenko if you could expand on your answer, that'd be helpful. Thanks. |
I had same issue and I used fetchOptions to use GET instead of POST. It is a work around not a fix.
|
For those still fighting with this issue, I switched to |
@mnmkng neither with |
Not |
I have the exact same issue, and nothing seems to work. const apolloClient = new ApolloClient({
uri: 'http://127.0.0.1:8000/graphql/',
credentials: 'include',
fetchOptions: {
credentials: 'include',
},
}) I am using vue-apollo and apollo-boost, if that makes a difference.
|
It seems that SameSite was causing the issue. Is disabling it the only solution? |
any update on this? I am using every possible credentails configs and I still cannot send cookies. Doesn't matter whether I use apollo-client or apollo-boost
|
Can you please share your configurations for the same? @mnmkng |
Why is this issue closed? I've seen no fix. Having same problem. |
For anybody still struggling with this, Ben Awad's solution in the following video worked for me https://www.youtube.com/watch?v=9EwvLpkuLSg Essentially, you use 'createHttpLink' from apollo-link-http and 'InMemoryCache' from apollo-cache-inmemory when creating your client. Something like this
|
I have the same issue and no previous solutions work for me. Any help ? |
For me it was a server side issue and nothing to do with the Apollo. Once I set credentials to ‘include’ I updated my CORS policy and whitelisted the client uri where Apollo is used. If you are using Django as a I am lmk and I can walk you through it |
Still have the problem. Golang server with with nextjs on the front... rest calls work just fine but can't seem to get my cookies on my graphql queries working. |
Any further insight? |
Related #4190 |
I have been stuck at this for a while now. Don't know what i am missing. I am using corsheaders and added following to settings.py |
@junaiid-khattak try this https://github.com/ottoyiu/django-cors-headers Looking back at my code I explicitly defined the urls in my whitelist. |
@thevaleriemack already have this. I don't think this is a CORS issue because it works fine with other clients. Cookies are there but apollo-client just wouldn't send them. After trying for few days, i decided to switch from cookie based auth to jwt and everything is better now |
If anyone needs help with Vue + Django. |
If you are here in 2020 With next JS => #5089 |
Apollo Server documentation says:
Although my backend server and frontend app are on the same domain, I had to change |
Intended outcome:
Want request cookies to be sent with query when
same-origin
is set.Actual outcome:
I followed the new docs for Authentication but the Request Cookies are not being passed.
This worked before upgrading and I haven't changed any code besides what was in the migration guide.
Code from 1.0.1 (worked fine, Request cookie is passed and came back with data)
Network tab:
Updated code to reflect 2.0.1 API:
Network Tab:
How to reproduce the issue:
Upgrade and use
createHttpLink
with opts: { credentials: 'same-origion' } and see no Request cookie passed. I'm usingexpress-session
on the backend, and have tried usingcors
as mentioned in the docs but to no avail.I'm not sure how to better debug but would love to know how so I can help fix it (if it is a problem). I could be messing something up but only upgrade-to-2.0 code changed so it seems suspect.
Version
The text was updated successfully, but these errors were encountered: