UNPKG

authkit-js

Version:

Express auth toolkit (JWT, Sessions with Redis, Google/GitHub OAuth) in JavaScript

11 lines (10 loc) 308 B
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 };