22 lines
659 B
JavaScript
22 lines
659 B
JavaScript
|
|
export const validateMedicationApiKey = (req, res, next) => {
|
||
|
|
const authHeader = req.headers['authorization'];
|
||
|
|
const token = authHeader && authHeader.split(' ')[1];
|
||
|
|
|
||
|
|
if (!token || token !== process.env.MEDICATION_API_KEY) {
|
||
|
|
return res.status(401).json({ error: 'Unauthorized - Invalid API Key' });
|
||
|
|
}
|
||
|
|
|
||
|
|
next();
|
||
|
|
};
|
||
|
|
|
||
|
|
export const validateShiftSyncApiKey = (req, res, next) => {
|
||
|
|
const authHeader = req.headers['authorization'];
|
||
|
|
const token = authHeader && authHeader.split(' ')[1];
|
||
|
|
|
||
|
|
if (!token || token !== process.env.SHIFTSYNC_API_KEY) {
|
||
|
|
return res.status(401).json({ error: 'Unauthorized - Invalid API Key' });
|
||
|
|
}
|
||
|
|
|
||
|
|
next();
|
||
|
|
};
|