UNPKG
authkit-js
Version:
latest (0.2.5)
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Express auth toolkit (JWT, Sessions with Redis, Google/GitHub OAuth) in JavaScript
authkit-js
/
middleware
/
requireAuth.js
8 lines
(7 loc)
•
215 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
function
requireAuth
()
{
return
function
(req, res, next)
{
if
(!req.auth || !req.auth.user)
return
res.
status
(
401
).json({
error
:
'Unauthorized'
});
next
(); }; }
module
.exports = { requireAuth };