Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement