Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Send value in body from angular2 service

I have an Angular2 service

logIn (username, password): Observable<User[]> {
  return this.http.get(this.getUserUrl + username + '/' + password)
     .map(this.extractData)
     .catch(this.handleError);
}

which sends a request to

router.get('/authenticate/:username/:password', function(req, res, next) {
schema.User.find({ username: req.param("username"), password: req.param("password")}).exec(function (err, users) {
    if (err)
      return console.error(err);
      console.log("Load success: ", users);
      res.send(users);
    });
});

but i need a way to send the username, and especially the password in a way which doesn't expose it to the request itself

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can change your methods to post

logIn (username, password): Observable<User[]> {
  return this.http.post(this.getUserUrl + "test", {username: username, password: password})
     .map(this.extractData)
     .catch(this.handleError);
}

node:

router.post('/authenticate/test', function(req, res, next) {
 var username = req.body.username;
 var password = req.body.password;
 schema.User.find({ username: username, password: password }).exec(function (err, users) {
    if (err)
      return console.error(err);
      console.log("Load success: ", users);
      res.send(users);
   });
});
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!