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

210
Vistas
request.getParameter return null

I work on spring boot and angular I made an authentication based on spring security I tested with postman and everything works fine, but when I use angular it does not work after debugging I noticed that request. getParameter("username") return null, the error is probably on the angular request, please can someone help me

 @Override
 public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
 throws AuthenticationException {

    // TODO Auto-generated method stub
    String username = request.getParameter("username");
    System.out.println(username);
    String password = request.getParameter("password");
    System.out.println(password);

    UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(username, password);
    return authManager.authenticate(authToken);
 }
//req angular
login(params:any) : Observable<any> {
      let username=params.username as string
      let password=params.password as string
     
     const FORM_URL = {
      headers:{
        'Content-Type': 'application/json'
      }
     }
    
     return this.http.post<any>(`${this.adresse+'/login'}`,{ 
      'username':username,
      'password':password
      }, FORM_URL)}
 }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

According to the documentation: Returns the value of a request parameter as a String, or null if the parameter does not exist.

Find out where this parameter should come from. Candidates are the client request, the container and the Sprint Boot framework. Once you know which side is supposed to set it, figure out why it does not.

One answer can be as simple as 'the user has not yet authenticated'. For a more focused response you'd have to share more details.

about 4 years ago · Juan Pablo Isaza 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