next-password-protect
next-password-protect copied to clipboard
bypassProtection example
Having trouble understanding how to use "bypassProtection". An example of this would be helpful.
Hey. It's meant to be able to have some pages (routes) that will not have this password protection applied. To use this, just add property to withPasswordProtect:
withPasswordProtect(MyApp, {
...
bypassProtection: (route) => {
return route.pathname === '/specific-page/that-doesnt-need-protection' || route.pathname === '/some-other-page'
}
})
In this example, pages with route /specific-page/that-doesnt-need-protection and /some-other-page will not be protected by password.
route is just object retrieved from useRouter, so you can use all its properties offered from NextJS.