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
/
authenticate.js
11 lines
(10 loc)
•
308 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
function
makeAuthenticate
(
kit, strategyName
) {
return
async
function
authenticate
(
req, _res, next
) {
try
{
const
ctx =
await
kit.
authenticate
(req, strategyName); req.
auth
= ctx ||
undefined
;
next
(); }
catch
(e) {
next
(e); } }; }
module
.
exports
= { makeAuthenticate };