Rest API - Authentication and Authorization
You have this API security code snippet:
app.get('/user', (req, res) => {
if (!req.headers['api_key']) {
res.status(401).send('Unauthorized');
return;
}
res.send('User data');
});
What is the main problem with this code?