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