mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 10:29:17 +00:00
resolved error handling issue with requireAuth middleware
This commit is contained in:
@@ -166,7 +166,6 @@ const main = async () => {
|
||||
);
|
||||
});
|
||||
|
||||
// await createTestUserForDevelopment();
|
||||
setUpHealthEndpoint(server);
|
||||
|
||||
server.on("close", async () => {
|
||||
|
||||
@@ -45,7 +45,7 @@ const requireAuth = ({
|
||||
|
||||
// validate auth token against accepted auth modes [acceptedAuthModes]
|
||||
// and return token type [authTokenType] and value [authTokenValue]
|
||||
|
||||
try {
|
||||
const { authMode, authTokenValue } = validateAuthMode({
|
||||
headers: req.headers,
|
||||
acceptedAuthModes
|
||||
@@ -94,6 +94,9 @@ const requireAuth = ({
|
||||
}
|
||||
|
||||
return next();
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
getMongoURL,
|
||||
getSentryDSN
|
||||
} from '../../config';
|
||||
import { initializePassport } from '../auth';
|
||||
|
||||
/**
|
||||
* Prepare Infisical upon startup. This includes tasks like:
|
||||
@@ -48,6 +49,7 @@ export const setup = async () => {
|
||||
|
||||
// initializing the database connection
|
||||
await DatabaseService.initDatabase(await getMongoURL());
|
||||
await initializePassport();
|
||||
|
||||
/**
|
||||
* NOTE: the order in this setup function is critical.
|
||||
|
||||
Reference in New Issue
Block a user