NuxtN
Nuxt13mo ago
4 replies
-

How to access the request event from within @sidebase/nuxt-auth NuxtAuthHandler?

I'd like to access the request event from within NuxtAuthHandler callbacks. I need this in order to set additional cookies / or access objects on event.context.

This was one of the attempts I tried:

import { NuxtAuthHandler } from '#auth'
import { useRequestEvent } from 'nuxt/app';

export default NuxtAuthHandler({
  callbacks: {
    async signIn({ account }) {
      const event = useRequestEvent()
    },
    async session({ session }) {
      const event = useRequestEvent()
      return session
    },
    async jwt({ token }) {
      const event = useRequestEvent()
      return token
    },
  },
});


However, this results in the following error:

 ERROR  RollupError: [plugin impound] Vue app aliases are not allowed in server runtime.


What's an alternative to access the request event in this case?
Was this page helpful?