authjs-nuxt
authjs-nuxt copied to clipboard
not authenticated in plugins
Environment
Nuxt project info: 5:45:40 p.m.
- Operating System: Windows_NT
- Node Version: v18.17.1
- Nuxt Version: 3.8.0
- CLI Version: 3.9.1
- Nitro Version: 2.7.0
- Package Manager: [email protected]
- Builder: -
- User Config: alias, devtools, ssr, modules, authJs, runtimeConfig, apollo, i18n
- Runtime Modules: @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @hebilicious/[email protected]
- Build Modules: -
Reproduction
If you use useAuth()
in a plugin (like in ~/plugins/randomPlugin.ts
), you're not authenticated.
Describe the bug
It should authenticate before the plugins. It makes it impossible to use it with @nuxtjs/apollo
Additional context
No response
Logs
No response
useAuth
can be used within a plugin, look at the source code here https://github.com/Hebilicious/authjs-nuxt/blob/main/packages/authjs-nuxt/src/runtime/plugin.ts
It's possible that you have an ordering issue and that your nuxt apollo plugin runs before this one. Do you have a reproduction ?