Chapter 14: Adding Authentication – Dashboard still accessible without login.
Hello everyone,
In Chapter 14, Adding Authentication (https://nextjs.org/learn/dashboard-app/adding-authentication), I followed all the instructions. However, I can still access the dashboard directly at http://localhost:3000/dashboard even when I’m not logged in. It should redirect to the login page, but instead, I can see the dashboard content.
Is anyone else experiencing the same issue?
Yes I am having the same issue, did you able to fix?
Also having this issue. I've seen others reference middleware.ts so maybe that file is missing from the tutorial? Or possibly the proxy matcher is incorrect but I'm not sure what it should look like instead.
Also having this issue. I've seen others reference middleware.ts so maybe that file is missing from the tutorial? Or possibly the proxy matcher is incorrect but I'm not sure what it should look like instead.
Good point about middleware.ts. However, the middleware file convention has been deprecated and renamed to proxy.
https://nextjs.org/docs/app/api-reference/file-conventions/proxy
It looks like the issue is due to the Next.js version. The tutorial project installed an older Next.js version where middleware.ts is still the convention, while the tutorial assumes proxy.ts (Next 16+).
If you rename your proxy.ts file to middleware.ts, authentication will work correctly again.
The problem comes from package.json using "next": "latest", which doesn’t actually install v16 — probably because other dependencies prevent the upgrade.
Manually updating it to:
"next": "^16.0.1"
fixes the issue.
It looks like the issue is due to the Next.js version. The tutorial project installed an older Next.js version where
middleware.tsis still the convention, while the tutorial assumesproxy.ts(Next 16+). If you rename yourproxy.tsfile tomiddleware.ts, authentication will work correctly again.The problem comes from
package.jsonusing"next": "latest", which doesn’t actually install v16 — probably because other dependencies prevent the upgrade. Manually updating it to:"next": "^16.0.1" fixes the issue.
Ohh, cool — I renamed proxy.ts to middleware.ts and it’s working now. Thanks so much for your help!