Simple overview of use/purpose.
An in-depth paragraph about your project and overview of use.
| const jwt = require('jsonwebtoken'); | |
| module.exports = { | |
| async authenticateToken(request, response, next) { | |
| const authHeader = request.headers['authorization'] | |
| const [scheme, token] = authHeader && authHeader.split(' '); | |
| if (token === null) return response.status(401).json({ error: 'No token provided' }); | |
| if (!/^Bearer$/i.test(scheme)) |