Static GitHub Issues

[2507] how to set cookie in middleware

prev: NuxtServerInit may be have a major problem
next: Problem with routing on different layout on cloudfront

middleware/auth.js

export default function (context) {
 const token = context.route.query.token
  if (token ) {
     // Cookie.setToken(token).
  }
}
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2176">#c2176</a>)</em></sub></div>