Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda