#Middleware and NextAuth

3 messages · Page 1 of 1 (latest)

green geyser
#

hello everone, my name is tayyib from Sierra Leone, am very sorry for distrubing you am a beginner in next am building this application https://github.com/tayyibGbondo/teenkonnets but i have problem with the middleware and nextauth/jwt
i protected the root file "/" but i want when a user login they should be redirected to the protected page ("/") instead of the login page.

glad pebble
#

I would recommend not protecting every path under / since you might run into more problems as you expand the site. However if this is what you want the I would check the middleware docs, you can redirect the user if request.nextUrl.startsWith("/") && request.nextUrl != "/login" or something like that

green geyser
#

ok sir and thanks very much sir i really apperciate sir