-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Able to set client cookie from server generated cookie? #17
Comments
@Ajaay you can use |
According to the docs this is only available to the Client?
Are you saying that if I initiate send from the client and then catch it on the server with the opts.onCookies hook that I can then respond back to the client with a new set of cookie values?
Thanks
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: dr.dimitru <notifications@github.com>
Sent: Thursday, May 21, 2020 5:30:26 PM
To: VeliovGroup/Meteor-Cookies <Meteor-Cookies@noreply.github.com>
Cc: Ajaay <ajchapman88@hotmail.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [VeliovGroup/Meteor-Cookies] Able to set client cookie from server generated cookie? (#17)
@Ajaay<https://github.com/Ajaay> you can use .send() method to synchronize server and client cookies.
Use opts.onCookies hook for this purpose, note: cookies on the server are stateless
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#17 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABO3LP2Z6TQZA4ZRVQFAVG3RSVJKFANCNFSM4NG22I5A>.
|
@Ajaay yes, just set new cookies on this hook, and it will be delivered to the Client. |
Ok I’ll give it a shot. My only worry with that is how I can ensure the client initiates the send after the server has received the cookie data from AWS..
Perhaps I just need to keep retrying on the client until a value is set successfully...
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: dr.dimitru <notifications@github.com>
Sent: Thursday, May 21, 2020 6:10:20 PM
To: VeliovGroup/Meteor-Cookies <Meteor-Cookies@noreply.github.com>
Cc: Ajaay <ajchapman88@hotmail.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [VeliovGroup/Meteor-Cookies] Able to set client cookie from server generated cookie? (#17)
@Ajaay<https://github.com/Ajaay> yes, just set new cookies on this hook, and it will be delivered to the Client.
Let me know if you will have any issues with it
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#17 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABO3LPZNUOQUCIXM5QPS2UDRSVN7ZANCNFSM4NG22I5A>.
|
Maybe you should use pub/sub to reactively send data to the user once data received from AWS? You don't have to use "real" MongoDB collection, see "counts" example in Meteor's docs |
Ok yeh that looks like it could do it - great shout thanks. Just working through the send - onCookies hook and I've managed to get something set in the client. What I'm seeing though is that if I try to set more than one cookie, only the last set call finds it's way to the client. For example:
Only CloudFront-Signature ends up on the client. I've checked it's not an issue with what I'm setting in the others because commenting any of them out, it's always the last one that gets set.. Trying to work my way through the source code to figure out why this might be but struggling at the moment.. Any ideas? Thanks for your help! |
@Ajaay thank you for reporting about this, labelled as "maybe" [bug] |
@dr-dimitru My current theory is that it's because we're using this.response.setHeader in the set method, which will only allow us to set a single cookie. Perhaps we can create a valid cookieString for each of this.cookies and then use this.response.writeHead to send them all at once? |
@dr-dimitru Found something interesting while trying to troubleshoot this today... If I browse directly to http://localhost:3000/__cookie__/set , all 3 cookies appear in the browser. I'm doing some packet captures on my machine to dig into the HTTP headers but at the moment I can't spot any difference between what is being sent and received from the 'send' method, and then when browsing direct... It's a strange one. |
Hello @Ajaay I'm sorry it's been a while, have you solved this issue? How? |
Hi,
I am generating cookies with AWS on the Accounts.Login hook on the server, and want to be able to then set these cookies on the client.
Is this possible with this package?
I've followed both documented example setups, but I'm not able to retrieve them on the client after they've been set on the server.
I see there is a 'send' method to forward cookies from client to server, but I really need to reverse of this.
Thanks!
The text was updated successfully, but these errors were encountered: