HappiePlant
HappiePlant3mo ago

Oak Signed Cookies error

Hi! I keeping getting this error:
error: Uncaught (in promise) TypeError: keys required for signed cookies.
throw new TypeError("keys required for signed cookies.");
error: Uncaught (in promise) TypeError: keys required for signed cookies.
throw new TypeError("keys required for signed cookies.");
I tried searching for how to use a cookie secret, but I couldn't find it. This is the line where it fails:
ctx.cookies.set("clientState", "random-string", { maxAge: 1000 * 60 * 5, signed: true })
ctx.cookies.set("clientState", "random-string", { maxAge: 1000 * 60 * 5, signed: true })
1 Reply
HappiePlant
HappiePlantOP3mo ago
Oh all I had to do was
const app = new Application();
app.keys = ["my_cookie_secret"]
...
const app = new Application();
app.keys = ["my_cookie_secret"]
...

Did you find this page helpful?