Issue with NextAuth Authentication and URL Redirection in Nuxt.js #808
Labels
bug
A bug that needs to be resolved
p2
Nice to have
provider-authjs
An issue with the authjs provider
Environment
Reproduction
Not needed ...
Describe the bug
Hello everyone,
I'm encountering an issue with integrating NextAuth into my Nuxt.js application.
Context
I'm using the OAuth provider for authentication. When a user tries to access a protected route without being authenticated, they are redirected to the login page with callbackUrl and error query parameters.
Problem
After being redirected to the login page, the URL looks like this:
The error query parameter is set to undefined, and I would like to change this to a specific error message or remove it altogether.
When I do not use a custom login page, the URL looks like this:
Additional context
nuxt.config.ts:
auth: { isEnabled: true, provider: { type: 'authjs' }, globalAppMiddleware: { isEnabled: true, } }
[...].ts
import .... export default NuxtAuthHandler({ adapter: PrismaAdapter(prisma), secret: process.env.AUTH_SECRET, providers: [ ... ], pages: { signIn: '/', }, callbacks: { session({ session, user }) { if (session.user) { session.user.id = user.id; } return session; }, }
Logs
No response
The text was updated successfully, but these errors were encountered: