code: function getAuthUsernameAvailable(req, res) {
  
      if (!req.query || !req.query.username) {
        res.status(400).send('Please provide a username');
      } else {
        var query = {
          username: req.query.username
        };
  
        var userCollection = authConfig.strategy === 'password' ? users :
          providerAccounts;
  
        userCollection.find(query).exec()
          .then(function (matchingUsers) {
            res.status(200).send({
              data: matchingUsers.length === 0
            });
          })
          .then(null, util.makeErrorResponder(res));
      }
    }
docs: GET /auth/usernameAvailable - checks if a username is available. depends on users, or providerAccounts