I have created nuxt 3 app with @sidebase/[email protected] for authentication. It was able to connect to backend api(.NET) /login and /user-info sucessfully but when redirect after login, still redirect back to /login page.
I tried to prevent redirect after login using await signIn({user_name: 'test', password: 'user'}, { redirect: false }); and when I logged useAuth(), status is "authenticated" and token has value.
auth configuration in nuxt.config.ts
auth: {
globalAppMiddleware: true,
baseURL: process.env.API_BASE_URL,
provider: {
type: 'local',
pages: { login: '/login' },
endpoints: {
signIn: { path: '/login', method: 'post' },
signOut: false,
getSession: { path: '/user-profile', method: 'get' }
}
}
}
I new in @sidebase/nuxt-auth. It's look like your auth module doesn’t save your auth data in composable state, so you have redirected back to the /login page, because you set globalAppMiddleware: true in your config file.
I'm also using
@sidebase/[email protected]with[email protected]and[email protected]but for me auth state successfully set after calling/loginand/userendpoints.nuxt.config.ts
login.vue