mirror of https://github.com/boxyhq/jackson.git
Refactor API route validation in middleware.ts
This commit is contained in:
parent
8be2e20f90
commit
f23eb97161
|
@ -19,7 +19,6 @@ const unAuthenticatedApiRoutes = [
|
|||
'/api/setup/**',
|
||||
'/api/branding',
|
||||
'/api/scim/cron/**',
|
||||
// '/api/internals/product/**',
|
||||
];
|
||||
|
||||
export async function middleware(req: NextRequest) {
|
||||
|
@ -45,8 +44,7 @@ export async function middleware(req: NextRequest) {
|
|||
}
|
||||
|
||||
// Validate API routes `/api/v1/**`
|
||||
// Question: Is it okay to use same API key?
|
||||
if (micromatch.isMatch(pathname, ['/api/v1/**', '/api/internals/product/**'])) {
|
||||
if (micromatch.isMatch(pathname, ['/api/v1/**', '/api/internals/**'])) {
|
||||
if (!validateApiKey(extractAuthToken(req))) {
|
||||
return sendUnAuthorizedResponse({ message: 'Unauthorized' });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue