# How to setup secret for Signed Cookies?

**URL:** <https://discourse.nodered.org/t/how-to-setup-secret-for-signed-cookies/50305>\
**Category:** General\
**Tags:** http-request\
**Created:** [27 August 2021 23:39 UTC](https://discourse.nodered.org/t/how-to-setup-secret-for-signed-cookies/50305 "2021-08-27T23:39:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![itheemonk](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@itheemonk](https://discourse.nodered.org/u/itheemonk)\
**Post date:** [27 August 2021 23:39 UTC](https://discourse.nodered.org/t/how-to-setup-secret-for-signed-cookies/50305/1 "2021-08-27T23:39:34Z")

</div>

Hi,

I'm trying to get cookie signing working with my flow.

When I try to create a signed cookie I get an error "Error: cookieParser("secret") required for signed cookies"

So my question is how do I get access to the cookieParser object to reinitialize it with a secret, or is there somewhere I can just put the secret (like in setting.js)?

I wondered if it was possible from inside httpNodeMiddleware: function(req,res,next)  
so initially I just tried adding the following to the middleware function

```auto
app.use(cookieParser())

```

But that just gives an error "app is not defined"

Then I read this post: [[feature request] middleware integration](https://discourse.nodered.org/t/feature-request-middleware-integration/37890)  
But I can't seem to make that work either, cookieParser is not defined.

Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 October 2021 23:40 UTC](https://discourse.nodered.org/t/how-to-setup-secret-for-signed-cookies/50305/2 "2021-10-26T23:40:12Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
