Hebilicious / authjs-nuxt

AuthJS edge-compatible authentication Nuxt module.
https://authjs-nuxt.pages.dev/
MIT License
246 stars 30 forks source link

not authenticated in plugins #121

Open Vinccool96 opened 8 months ago

Vinccool96 commented 8 months ago

Environment

Nuxt project info: 5:45:40 p.m.


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

Hebilicious commented 8 months ago

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 ?