Next.js request.nextUrl.pathname return always /
In nextjs , I am trying to get current url path in middleware by using request.nextUrl.pathname. Currently request.nextUrl.pathname always return ‘/’ for any route. For example when I try with http://localhost:3000/dashboard, request.nextUrl.pathname returns ‘/’ but I expect /dashboard. What do I miss ?
Why does redirect not happen immediately when visiting a page with Next.js and next-auth?
I have a client-side component where I call the useSession method from the next-auth library, and if the user is not logged in, I redirect them. The problem is, when I visit the /clientmember page while logged out, the page opens and shortly after, it redirects asking me to log in. Why doesn’t the redirect happen immediately when the page is first loaded?
next-auth signIn on custom page method doesn’t work but /api/auth/signIn works fine
the signIn method from next-auth/react
doesn’t work in my custom page but when I remove the pages section in my NextAuthOptions the /api/auth/signin with next-auth’s default page works and I can login fine. any ideas what that might be the case?
I am having issue in Next.js
I am having error :
Sign in oAuthCallback Error in next js 14 or above using google providers
I am creating sign in functionality using Next-Auth with google providers i have created a dropdown menu in this menu user will be able to click and then click on sign-in button. it redirects to api/auth/signin?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2F where user selects the sign in with goole after clicking sign-in with google it leads to email and password verification page. where user enters email and password after verification it didn’t redirect to my application and shows errors. here are the errors
Next.js/next-auth: Additional variable added to session but not available when using getServerSession()
I’m working on a Next.js application where I’m using next-auth for authentication. I’ve been trying to add an additional variable to the user session to store custom data. I’ve updated the authentication routine accordingly and added the additional variable to the session. However, when I access the session using getServerSession()
, the additional variable doesn’t seem to be available.
Next js 14 + NextAuth.js v5 on production with Nginx what should i set the AUTH_URL
what should I set the AUTH_URL on production while I am deploying the project using Nginx web server when i set AUTH_URL domain name the project does run
I get error Request Header Or Cookie Too Large
while if I keep localhost:3000 the project run while but on error it redirect to localhost:3000/error
Because the baseUrl in next auth is localhost:3000
this is nginx config
nextjs callbacks authorized never called
Using the following NextAuthConfig (with some areas redacted), I cannot get callbacks.authorized to fire. It is mentioned in the official docs https://authjs.dev/reference/next-auth#authorized with some kind of dependency on middleware, though that does not seem clear to me. Any ideas?
Next Auth: localhost code redirecting me to domain or production URL on login
I deployed my app but when I went back to localhost to continue with the development, when I tired to login by google it redirected me to the URL in production.
Why is Next-Auth creating two tokens in the browser?
I am using Next Auth with only 1 provider, Azure AD. Usually, Next-Auth with create a session token (__Secure-next-auth.session-token
) that I can send to my backend and decode for authentication.