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

144
Visualizações
How to use login and password from url to get request

I open my site with the address "http://login:password@localhost:3000/" How can I put an authorization data from url to get the requests? Like this:

Request URL: http://root:root@localhost:3000/vendor.chunk.js
Request Method: GET
Status Code: 304 Not Modified
Remote Address: 127.0.0.1:3000
Referrer Policy: strict-origin-when-cross-origin 

How can I get username and password from url with a Javascript? It is necessary for setting the authorization header for get request.

Thank you very much!

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

0

You can use the split function to achieve that, but it is highly unsafe to put your password into a URL. Whoever sees the URL, including the ISP can easily hack it.

var url = "http://login:password@localhost:3000/"
let parts = url.split("//")[1].split("@")[0].split(":");
let username = parts[0];
let password = parts[1];
console.log(username, password);

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