authjs-nuxt icon indicating copy to clipboard operation
authjs-nuxt copied to clipboard

not authenticated in plugins

Open Vinccool96 opened this issue 1 year ago • 1 comments

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

Vinccool96 avatar Oct 19 '23 21:10 Vinccool96

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 ?

Hebilicious avatar Oct 22 '23 13:10 Hebilicious