Files
asan-service/server/plugins/checkThirdPartyAccess.js
2023-08-17 13:05:51 +03:30

10 lines
331 B
JavaScript

const token = '8f552d860d0cdbbf4afaa0749acb7f3e32efcdc85fc4b49bb3d356ff30f0504a'
module.exports.checkThirdPartyAccess = (req, res, next) => {
try {
if (req.headers?.authorization?.trim() !== token) throw new Error('unauthorized')
else next()
} catch {
return res.status(422).json({ message: 'unauthorized' })
}
}