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

234
Visualizações
Getting Pop up window to login with basic authentication using Ajax?

Here I am trying to access reed.co.uk rest webapi to fetch all related jobs, When I call the URL, its showing this popup window even though I am passing username and password. This is the alert message I am getting:

http://www.reed.co.uk is requesting your username and password. WARNING: Your password will not be sent to the website you are currently visiting!

enter image description here

Pls help me where i am doing wrong.

Here is the Ajax code

var username = "xxxxx xxxxxxxxxxxxxxx";
var password = ""; 
function getAuthorizationHeader(username, password) {
var authType; 
var up = $.base64.encode(username + ":" + password);
authType = "Basic " + up;     
console.log(authType);
return authType;
};

$.ajax({
    type: "GET",
    url: "http://www.reed.co.uk/api/1.0/search?keywords=Software Engineer&locationName=London&distanceFromLocation=50",
    dataType: 'jsonp',
    async: false,
    beforeSend: function (xhr) {
        xhr.setRequestHeader('Authorization', getAuthorizationHeader(username, password));
    },        
    success: function (response) {            
        console.log(response);          
    }
});

I tried passing Authorization header like this also but still i am getting pop up window

headers: {
'Authorization': getAuthorizationHeader(username, password)
},
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It looks like it is expecting Basic Authentication. Thus you need to supply it at url.

For example:

$.ajax({
type: "GET",
url: "http://"+username+":"+password+"@www.reed.co.uk/api/1.0/search?keywords=Software Engineer&locationName=London&distanceFromLocation=50",
dataType: 'jsonp',
async: false,        
success: function (response) {            
    console.log(response);          
}});
about 4 years ago · Santiago Trujillo 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