Created
December 14, 2023 11:21
-
-
Save iamargentum/4817b75afd97bf6f363e5a4cb8f4280a to your computer and use it in GitHub Desktop.
auth exclusion snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// endpoints that do not need authentication | |
// "/_next" endpoint for development server | |
const unauthenticated_endpoints = [ | |
// next auth routes | |
"/api/auth", "/_next", | |
// client side routes | |
"/products", "/services", "/generate" | |
]; | |
// for endpoints that don't need authentication, just pass | |
if(unauthenticated_endpoints.some(ae => pathname.startsWith(ae)) || pathname === "/") { | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment