-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Transfer of cookies between the client and the server. #1449
Comments
I found a solution. in server.js:
example graphql mutation:
|
This was referenced Jan 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello. I use node.js as a layer between php server and client (browser). All requests go through graphql. Everything works well, but there is one problem - i cannot share cookie across graphql from client.
Here is the algorithm of actions:
The user makes a request to the graph and passes the scheme. The graph in the resolve method makes a request to api and passes the cookies. query method fetch api.
const AuthMutation = { type: ResponseType, args: { locale: { type: StringType }, password: { type: StringType }, username: { type: StringType } }, async resolve(parent, args, context) { const body = querystring.stringify(args); const headers = { 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': cookieToString(context.req.cookies) }; const {object} = await queryFetch(api.gqlAPI.auth, 'POST', headers, body); return object; }, };
how to pass cookies from the 'resolve' method to the client
The text was updated successfully, but these errors were encountered: