Skip to content

Commit

Permalink
Update auth.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldablju authored May 6, 2022
1 parent ccbce08 commit 91e20c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const authenticateToken = (req, res, next) => {
const authHeader = req.headers['authorization']
const token = authHeader && authHeader.split(' ')[1]
if (token == null) return res.status(400).json({
message: "Token nie został przeslany!",
message: "The token has not been sent!",
status: 400
})

jwt.verify(token, process.env.TOKEN_KEY, (err, user) => {
if (err){
return res.status(403).json({
message: "Token jest błędny lub wygasł!",
message: "Invalid token!",
status: 403
})
}
Expand All @@ -20,4 +20,4 @@ const authenticateToken = (req, res, next) => {
})
}

module.exports = authenticateToken;
module.exports = authenticateToken;

0 comments on commit 91e20c2

Please sign in to comment.