koajs / csrf

CSRF tokens for koa
MIT License
264 stars 32 forks source link

Add csrf token in ctx.state #50

Closed hvintik closed 2 years ago

hvintik commented 4 years ago
Screenshot 2019-12-25 at 16 25 30

ctx.state is a recommended namespace for passing information through middleware and to your frontend views.

titanism commented 2 years ago

This will be resolved in v4.0.0 released to npm later today

titanism commented 2 years ago

Released koa-csrf v4.0.0, which requires Node >= 14.

https://github.com/koajs/csrf/releases/tag/v4.0.0

titanism commented 2 years ago

Actually, we're deprecating v4.0.0 and just released v4.0.1. All the "getter" internals need rewritten to actually support "ctx.state.csrf" properly.

titanism commented 2 years ago

v5.0.0 is released which strictly and only supports ctx.state._csrf 🎉

Note we also added errorHandler function option. See the notice at the top of the README or view the releases tab for more insight:

https://github.com/koajs/csrf/releases/tag/v5.0.0