nuxt-alt / auth

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

useRuntimeConfig is not defined #30

Closed RadBe closed 1 year ago

RadBe commented 1 year ago

I install clean nuxt and nuxt-alt. When run: npm run dev, I get error: 500 useRuntimeConfig is not defined project/.nuxt/auth.plugin.mjs:48:60

This place in here: https://github.com/nuxt-alt/auth/blob/main/src/plugin.ts#L40

steklopod commented 1 year ago

@RadBe useRuntimeConfig is related ti Nuxt. Not for auth module. Try this:

useAuth().tokenStrategy.token?.get()
Xezard commented 1 year ago

The error occurs only when automatic imports are disabled in nuxt itself - because there is no direct import in the module and it crashes. If you enable automatic imports from nuxt - import useRuntimeConfig will resolve automatically.