vue-cookies icon indicating copy to clipboard operation
vue-cookies copied to clipboard

httpOnly?

Open bahiamartins opened this issue 2 years ago • 2 comments

missing httpOnly

bahiamartins avatar Nov 21 '22 17:11 bahiamartins

HttpOnly cannot be set in the browser client side (in JavaScript). there's no API available to get/set the HttpOnly attribute of the cookie, as that would otherwise defeat the meaning of HttpOnly.

see #51

cmp-cc avatar Nov 22 '22 14:11 cmp-cc

In my case I just need to make sure the session exist so I wrote this function;

  methods: {
    doesSessionExist(cookieName) {
      this.$cookies.set(cookieName, 'new_value', '1s')

      return !this.$cookies.get(cookieName)
    }
  }

and call like so this.doesSessionExist('session_cookie_name') if you can set the cookie it does not exist.

wshostak avatar Mar 15 '23 08:03 wshostak