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

184
Visualizações
Getting authentication error "Unable to find credentials in request" when I make a POST request in Cypress automation

I'm making a POST request in cypress automation but I keep getting an authentication error. The endpoint takes basic authetication.

  "error": "AuthenticationError",
  "text": "Unable to find credentials in request". 

Here is my request:
 
 cy.request({
                    url: 'TEST ENDPOINT',
                    method : 'POST',
                    auth: { 
                        username: 'test@test.com', 
                        password: 'test1'
                    }, 

                  body: {
                        
                        "firstname": "Bruce",
                        "lastname": "lee"
                 
                    });
 
          });

When I hit the same endpoint in POSTMAN it works as expected. Not sure what's wrong with my request.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is no key called "auth", you should use either Header to pass your token or auth key in it.

method: 'POST',
    url: url,
    headers: {
        'content-type': 'application/json',
        'Accept': 'application/json',
        'Authorization':'Bearer '+token
    },
    body: JSON.stringify(body)
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