How to set cookie with httpOnly flag in nuxt?

mytc
0
mytc
commented 7 months ago

I am using social oauth2 for authentication, once authenticated, it will send to backend server to exchange a jwt token from a rest api endpoint.
I also use double submitted cookie method to securely store the jwt and crsf token in web app. However, since Nuxt is javascript, so it cannot set cookie with httpOnly flage on?
But according to this issue https://github.com/nuxt/nuxt.js/issues/575, some said it is possible. But how? Can someone show me how to do it?
Like do it on the component method?

0
Atinux
21.0k
Atinux
commented 6 months ago

Hi @mytc

You can take a look at https://github.com/Atinux/nuxt-heroes/blob/master/server-middleware/github-callback.js#L16

The application uses cookies with httpOnly :)

0
Informations
Question โ€ข Resolved
#c21 - Created 7 months ago