Set custom cookies from NodeBB
-
I am using a plugin that allows users to auth using my own oAuth system. I figured out that I can not set an HttpOnly cookie across domains from the response header, so I am trying to figure out if there is a hook within NodeBB that will allow me to set a cookie. My oAuth system resides on a different domain. I could duplicate it on the current domain, but would really like to avoid it. Can anyone offer any help?
-
You can set cookies with
res.cookie
: https://expressjs.com/en/api.html#res.cookieDepending on whether you want that cookie set only on a certain route or on all routes, you might need to register an express middleware.
-
Thank you @PitaJ . I'm unsure which file in the NodeBB repo to adjust if I want to add a cookie to the response though. I'm fairly new to express rendered templates. Would you recommend me working in the render.js file?
-
You should be able to do it within your plugin. What have you tried?