Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Register hapi-auth-jwt
- plugin.register(HapiAuthJWT, (err) => {
- if (err) {
- console.log('HapiAuthJWT plugin registration: ', err);
- }
- });
- const strategyOptions = {
- key: KEY,
- validateFunc(request, decoded, cb)
- {
- if ( !decoded.userId || !decoded.accountId) {
- cb(null, false);
- }
- cb(null, true, decoded);
- },
- verifyOptions: {
- maxAge: EXPIRES_IN,
- }
- };
- plugin.auth.strategy('token', 'jwt', strategyOptions);
Advertisement
Add Comment
Please, Sign In to add comment