nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
94 stars 20 forks source link

3.0.0 does not work #81

Closed steklopod closed 7 months ago

steklopod commented 7 months ago

Environment

Nuxt Config

import { defineNuxtConfig } from 'nuxt/config'
const host = 'http://localhost:8080'

export default defineNuxtConfig({
  modules: ['@nuxt-alt/auth', '@pinia/nuxt'],
  auth: {
    scopeKey: 'scope',
    globalMiddleware: true,
    routerStrategy: 'navigateTo',
    strategies: {
      localStorage: false,
      refresh: {
        scheme: 'refresh',
        provider: () => {}, // https://github.com/nuxt-alt/auth/issues/54#issuecomment-1574969850
      },
    },
  },
})

Reproduction

https://stackblitz.com/edit/github-eptmme?file=nuxt.config.ts

Describe the bug

Снимок экрана 2023-11-25 в 16 16 58 Снимок экрана 2023-11-25 в 16 17 13

Additional context

Also it does not work on mac

Logs

> watch.plugin.mjs?v=b05b8dee:1 Uncaught ReferenceError: defineNuxtPlugin is not defined
    at watch.plugin.mjs?v=b05b8dee:1:1
steklopod commented 7 months ago

Also in release notes:

Снимок экрана 2023-11-25 в 16 20 03

It can not start without pinia.

Denoder commented 7 months ago

@steklopod for now you will have to disable watchLoggedIn, it seems that it's registering the watch plugin before the auth plugin and it's utils.

Does this happen locally or only in stackblitz?

toniengelhardt commented 7 months ago

@Denoder I also see this locally. Will it work correctly if I disable watchLoggedIn?

Denoder commented 7 months ago

yes. If you need the watch plugin, just create one manually and register it til I release the next version.

steklopod commented 7 months ago

Thabks for quick reply 👍🏻

I tested with watchLoggedIn: false, inside nuxt.config.ts and it works.

What is it for:

When enabled (default) user will be redirected on login/logouts.

toniengelhardt commented 7 months ago

yes. If you need the watch plugin, just create one manually and register it til I release the next version.

Thanks 🙏🏽