Static GitHub Issues

[1141] best way to populate session user without server?

prev: [Vue warn]: You are using the runtime-only build of Vue...
next: Can i set head option for component (not pages component)?

I'm working on implementing a token auth and wondering what would be the most straight forward and minimal approach.

Storing token in cookie and populating during nuxtServerInit. I know that population is not necessary but there is a 4k cookie limit and additional data may be needed.

The question I have with this approach is, what happens if I want to nuxt generate. I know nuxt generate works for static content, but for things dynamic like the user, I'm assuming it not to be generated. Meaning, nuxtServerInit cannot be the solution for this scenario.

I've read in another thread about introducing nuxtClientInit. The thread doesn't seem to talk specifically about user token population but I feel is a great solution. https://github.com/nuxt/nuxt.js/issues/240

Now since, nuxtClientInit is not available yet, my next thoughts are to use plugins or a middleware. Given the user only needs to be populated on initialization, I'm thinking plugin. Can I however, have the app wait on async operations from the plugin? If not, I guess the middleware is always available.

Would love to get some guidance here.

<!--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/c1001">#c1001</a>)</em></sub></div>