-
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
Cookies not sent to Server #4455
Comments
Issues here are reserved for bugs, but one of the following resources should help:
|
@danilobuerger this is a bug. Check issue #2443. Looks to me like issue #3407 is back. Because cookie is generated by I don't understand why you close it so fast. |
Alternatively its not a bug and you are using |
@danilobuerger I have tried Do you want feedback when there is a problem or you are more interested in closing unresolved issues? |
Even if it was a bug (which I don't think it is looking at the configuration above), I would still close it as apollo-client has nothing to do with it. Http handling is out of scope here as its handle by apollo-link-http and therefor in this repo: https://github.com/apollographql/apollo-link. |
Were you able to resolve this issue? |
@coommark I had the same issue with apollo boost. I started to use the apollo client packages with credentials "include" (because in my case the backend api is in another domain) and that solves my problems. Here the versions that I am using:
I hope you can solve your issue. |
As stated in my question, I use Next.JS, I guess the issue had to do with the SSR nature of Next.js (but not sure). Every setting suggested did not work for me. This is how I solved the problem:
|
hi @coommark , experiencing the same issue here. Could you tell me what your getUserFromLocalCookie function looks like? |
Here link to doc how to fix it https://www.apollographql.com/docs/react/recipes/authentication/#cookie |
Above link helped me. Following it, I added credentials
Also I need add credentials setting for backend. In mycase (rails cors), I add this settings.
|
For this bit, can you give an example of
|
Intended outcome:
I have three (3) applications proxied by express-http-proxy to port 8080. Each is running on a different port. Two of them are react (NextJS) frontend and admin apps. User must log in from the frontend before access to backend. The apollo-client setup for both of the UI apps are exactly the same, below:
import withApollo from 'next-with-apollo'
import ApolloClient, { InMemoryCache } from 'apollo-boost'
When a user logs in, I push their token to cookies so it can be sent back to the graphql api. This works with the actual app that the user authenticates on, but when I navigate to the backend app, the cookies are not sent.
In devtools I can see that the cookies are there alright, but they just don't get sent with requests.
I have tried this, but still, all cookies are not sent to server:
I have tried other variations of these. Note that when I use
http://localhost:8080/api/graphql
the cookies are sent ok since they all point to 8080, but when I send request via apollo-client, the cookies are not sent to the server.Versions
The text was updated successfully, but these errors were encountered: