@igea/oac_jwt_helpers
v1.0.13
Published
JWT helpers for the OAC project
Downloads
1,194
Readme
oac_jwt_helpers
JWT helpers for the OAC project
Usage
Import the library
const jwtLibFactory = require('@igea/oac_jwt_helpers')
const jwtLib = jwtLibFactory({
secret: SECRET,
excludePaths: ['/login'],
signOptions: { expiresIn: '1h' },
});Create a token
const token = jwtLib.createToken({ id: 123, role: 'admin' });Define a middleware
app = express();
app.use(express.json());
app.use(jwtLib.middleware); 