SHARE
TWEET

Untitled

a guest Oct 2nd, 2017 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function generateTokenBehavior(data) {
  2.     let username, password;
  3.     // checks for authorisation headers
  4.     if (_.has(data, 'headers.authorization')) {
  5.       username = auth(data).name;
  6.       password = auth(data).pass;
  7.     } ...
  8.     ... operations on username and password ...
  9.     responseData.status = 200;
  10.     responseData.data = {meta:{token}};
  11.     return responseData;
  12. }
  13.  
  14. function generateToken(req, res, next) {
  15.     const responseData = generateTokenBehavior(req);
  16.     return res.status(responseData.status).json(responseData.data);
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top