Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda