jLinux

Untitled

Dec 28th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   // Register hapi-auth-jwt
  2.   plugin.register(HapiAuthJWT, (err) => {
  3.  
  4.     if (err) {
  5.       console.log('HapiAuthJWT plugin registration: ', err);
  6.     }
  7.  
  8.   });
  9.  
  10.   const strategyOptions = {
  11.     key: KEY,
  12.     validateFunc(request, decoded, cb)
  13.     {
  14.       if ( !decoded.userId || !decoded.accountId) {
  15.         cb(null, false);
  16.       }
  17.  
  18.       cb(null, true, decoded);
  19.     },
  20.     verifyOptions: {
  21.       maxAge: EXPIRES_IN,
  22.     }
  23.   };
  24.  
  25.   plugin.auth.strategy('token', 'jwt', strategyOptions);
Advertisement
Add Comment
Please, Sign In to add comment