apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Cookies are not removed on the server

Open HaNdTriX opened this issue 6 years ago • 2 comments

Description

@nuxtjs/apollo uses universal-cookie this module can read cookies but afaik it doen't modify the res. So it can't remove the cookie.

res.setHeader('Set-Cookie', ['token=deleted; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT']);

This means onLogout and onLogin have issues when they are beeing called on the server.

Code

  • https://github.com/nuxt-community/apollo-module/blob/master/lib/templates/plugin.js#L135
  • https://github.com/nuxt-community/apollo-module/blob/master/lib/templates/plugin.js#L122
This question is available on Nuxt community (#c247)

@kieusonlam what do you think?

HaNdTriX avatar Oct 02 '19 20:10 HaNdTriX

This issue as been imported as question since it does not respect apollo-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload. If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically. Your question is available at https://cmty.app/nuxt/apollo-module/issues/c247.

ghost avatar Oct 02 '19 20:10 ghost

@HaNdTriX sorry for super slow response. I'm afraid so, universal-cookie doesn't modify the res on server side, then we have to manual handle where apolloHeplers function should be running. But I think it's not hard to manage that, asyncData created or middleware on Nuxt, they're running on both server sided and client side.

I used to use another package call cookie-universal but it's have some problem can't be solve. https://github.com/nuxt-community/apollo-module/issues/243

kieusonlam avatar Oct 28 '19 16:10 kieusonlam