nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.93k stars 925 forks source link

How to use Nuxt Auth with Pinia instead of Vuex ? #1763

Open juvpengele opened 2 years ago

juvpengele commented 2 years ago

I am working with a Nuxt 2 application and I would like to setup authentication using Nuxt Auth module. After have set a local strategy to handle authentication, I receive this warning in the console "[AUTH] The Vuex Store is not activated. This might cause issues in auth module behavior, like redirects not working properly"

I do not use Vuex as the state management library, How can I let know to auth to use pinia instead of Vuex ?

iusx commented 2 years ago

我正在使用Nuxt 2应用程序,我想使用Nuxt身份验证模块设置身份验证。设置本地策略以处理身份验证后,我在控制台中收到此警告“[AUTH] Vuex 存储未激活。这可能会导致身份验证模块行为出现问题,例如重定向无法正常工作”

我不使用Vuex作为状态管理库,我怎样才能让我知道使用pinia而不是Vuex?

According to your usage, I tried the github-auth demo yesterday, it seems that the status is packaged by vuex.This caused a lot of problems, like https://github.com/nuxt-community/auth-module/issues/1766, which returned a post request error in the console, maybe it needs to be changed?

ttkoma commented 2 years ago

@juvpengele Hi maybe it helps https://github.com/nuxt-community/auth-module/issues/1273#issuecomment-904060260

My latest used gist- nuxt-auth + pinia instead vuex