next-auth
next-auth copied to clipboard
fix(middleware): use `includes()` for NextAuth pages
Something went wrong with #5085, GitHub wasn't updating the PR with the new commits
โ๏ธ Reasoning
Some users could be setting their signIn and error pages option to
/ to disable the automatically generated pages, as suggested in https://github.com/nextauthjs/next-auth/discussions/2330#discussioncomment-1678298.
This PR reverts the behaviour for matching signIn and error
pages in handleMiddleware to pre-v4.10.3.
EDIT:
const signInPage = "/"
const errorPage = "/"
const publicPaths = [signInPage, errorPage, "/_next", "/favicon.ico"]
// pathname = "/protected" will always return true
publicPaths.some((p) => pathname.startsWith(p))
Fixes: aedabc8d ("fix: avoid redirect on always public paths")
๐งข Checklist
- [ ] Documentation
- [x] Tests
- [x] Ready to be merged
๐ซ Affected issues
๐ Resources
- Contributing guidelines
- Code of conduct
- Contributing to Open Source
The latest updates on your projects. Learn more about Vercel for Git โ๏ธ
1 Ignored Deployment
| Name | Status | Preview | Updated |
|---|---|---|---|
| next-auth | โฌ๏ธ Ignored (Inspect) | Sep 18, 2022 at 3:52AM (UTC) |
Thanks again @Juneezee! ๐