conflict in using @nuxtjs/auth
See original GitHub issuehow to use vuex-persist and @nuxtjs/auth I can’t login when I implement nuxt plugin
import VuexPersistence from 'vuex-persist'
export default ({ store }) => {
window.onNuxtReady(() => {
new VuexPersistence({
/* your options */
modules: ['account']
}).plugin(store)
})
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Nuxtjs auth module - token endpoint in auth strategies ...
Is John 2:23-25 there to tell us that Jesus' conflict with the Jewish leaders wasn't a Jewish problem but a human problem? How...
Read more >Authentication in Nuxt app - BlowStack
First install the official authentication module for Nuxt. npm i @nuxtjs/auth. COPY. After installation add auth module to the nuxt config.
Read more >@nuxtjs/auth - Awesome JS
This helps to prevent application crashing with auth module. (b58ca17); resetOnError is set to false by default. Previously any network error was causing ......
Read more >How to configure Okta to work with Nuxtjs Auth Module?
Hi there, I'm struggling on configuring my Okta App credentials with my NuxtJS app. I read this article from Andy March ...
Read more >@nuxtjs/firebase social auth - DEV Community
Tagged with nuxt, firebase, auth. ... worker in dev environment to avoid conflicts with HMR // only set this true for testing and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you SO MUCH for this @PRAJINPRAKASH !!! This was a life saver!!!
In order to get things working on my end, I followed your instructions and did the following:
in
/nuxt.config.js
, I made the following edit:from
to (removed the Vuex Persist plugin that the Vuex-Persist doc says we need to have)
then… I deleted the plugin file -
/plugins/vuex-persist.js
- which, for posterity’s sake had the following code in it:Finally, I updated my root Store file with @PRAJINPRAKASH’s suggestion - but also needed to ensure the Vue-Persist
RESTORE_MUTATION
mutation is declared as well - else Vuex-Persist will be unable to restore the state from on page reload.In the root Store file at
/store/index.js
:So, with just the above file, I’ve finally got Vuex-Persist working with Nuxt.js with Nuxt Auth module turned on and working AND, the main reason why I was having so many issues - that, if you are logged out then refresh your login page (as configured in
nuxt.config.js
in theauth
module’sredirect
options) and then try to login, upon successful login, the page would not redirect to the next page - regardless of whether you set theauth.redirect.home
option innuxt.config.js
or, if you usethis.$auth.loginWith('local',...).then(()=>{ this.$router.push('/'); });
, neither option worked.The above has finally fixed things, what a relief - and the end of some 5 days of debugging!
EDIT:
As far as this Issue is concerned, I think it would be great if the Vuex-Persist documentation could benefit from being updated so that the section for use with Nuxt explains what to do if a project uses Nuxt Auth.
I’d also really like to understand what the problem was/is - @PRAJINPRAKASH, could you please explain why the existing documentation causes this issue if you’re able to?
Thanks everyone!
Still some issues with Auth module
use this
instead of this in the documentation