Nuxt.js: guard pages with vuex authenticated user

Created on 6 Jan 2017  路  7Comments  路  Source: nuxt/nuxt.js

Hello,
I'm currently searching how to guard pages within nuxt. I have a vuex in place and after authentication I store the user in $store.state.authUser.
Is there a best practice how to wait if authUser state is set?
Thanks!

This feature request is available on Nuxt.js community (#c82)

Most helpful comment

Hi @Atinux great news. Could you add a complete example how to make this work? I was reading the docs but still not sure how to persist the authenticated user on server and client side through a server/client session that on page reload the user still logged in.

Thanks for this great tool!

All 7 comments

Hi @dohomi

The middleware (upcoming feature) will let you create rules for rendering specific pages with Nuxt.js, the authenticated pages is a perfect example of using the middleware.

Great news! Any ETA for that release? Cheers

Actually not any ETA but as soon as possible, you can follow our progress here: https://github.com/nuxt/nuxt.js/projects/1

The middleware feature is out with the 0.9.8 release.

Hi @Atinux great news. Could you add a complete example how to make this work? I was reading the docs but still not sure how to persist the authenticated user on server and client side through a server/client session that on page reload the user still logged in.

Thanks for this great tool!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaredreich picture jaredreich  路  3Comments

vadimsg picture vadimsg  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

danieloprado picture danieloprado  路  3Comments

vadimsg picture vadimsg  路  3Comments