Closed mylastore closed 4 years ago
Setting a cookie is not something that koa-jwt has in its remit. Its quite simple to do without any libraries though:
// somewhere inside a koa middleware function:
const jwt = 'blah:blah:blah'; // if this is the JWT that you want to set as a cookie
const cookieOptions = {
// see here for options:
// https://koajs.com/#ctx-cookies-set-name-value-options-
};
// COOKIE_NAME should match `opts.cookie` that is passed to koa-jwt,
// if koa-jwt is authenticating against the cookie that you want to set
ctx.cookies.set(COOKIE_NAME, jwt, options);
Does anyone knows how to store JWT token in a cookie with koa-jwt?