Skip to content

Instantly share code, notes, and snippets.

@iamargentum
Created December 14, 2023 11:21
Show Gist options
  • Save iamargentum/4817b75afd97bf6f363e5a4cb8f4280a to your computer and use it in GitHub Desktop.
Save iamargentum/4817b75afd97bf6f363e5a4cb8f4280a to your computer and use it in GitHub Desktop.
auth exclusion snippet
// 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