Authentication not working
Answered
Bell's Vireo posted this in #help-forum
Bell's VireoOP
I am a newbie to authentication and nextjs in general. I was just following the nextjs dashboard application tutorial on the official nextjs website. I am currently in the authentication section, and I have tried to replicate everything that was spoken about in the tutorial, but it doesn't seem to be working.
First, I can access my dashboard page even without logging in.
When I attempt to login with the correct details, I am not redirected to the dashboard page.
I am not exactly sure where the problem is at all, I am willing to provide the full code if requested, thanks.
First, I can access my dashboard page even without logging in.
When I attempt to login with the correct details, I am not redirected to the dashboard page.
I am not exactly sure where the problem is at all, I am willing to provide the full code if requested, thanks.
Answered by Bell's Vireo
I think I found the problem, I didn't spell the middleware.ts file correctly🥹
11 Replies
Alligator mississippiensis
do you have a link to your repo with the code?
@Alligator mississippiensis do you have a link to your repo with the code?
Bell's VireoOP
The repo is mentioned above.
Alligator mississippiensis
hmm your code matches the tutorial, so the only thing I can think of is the env variable. did you set
AUTH_SECRET?I also thought all routes would be protected until authentication is successful.
But right now I can any part of the app without being authenticated
But right now I can any part of the app without being authenticated
@Alligator mississippiensis hmm your code matches the tutorial, so the only thing I can think of is the env variable. did you set `AUTH_SECRET`?
Bell's VireoOP
I think I found the problem, I didn't spell the middleware.ts file correctly🥹
Answer
Yeah “midleware” is a typo
@joulev Yeah “midleware” is a typo
Bell's VireoOP
Thanks