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

127
Vistas
Passing sessionstorage item into a link JavaScript or HTML

I am trying to create a single sign in, and far as I can think this would probably be the best.

My backend receives the request, checks for email, creates a JWToken and adds it to a link sent per email to the user.

Something along this line

function loadWindow() {
  var setsession = window.sessionStorage.setItem("JWT", 'tokentoken');
  window.open('http://localhost:8080/html/reset-password.html')
}

there must be some way, but no matter how I do this, the page will not load with a sessionstorage set.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This seems to have actually fixed it! It needed a const definition..

Just sticking it onto the end did not work, but this seems to:

function loadWindow() {
  const myWindow = window.open('http://localhost:8080/html/reset-password.html');
  myWindow.localStorage.setItem('JWT', 'cat');
}

enter image description here

Of course ideally would be directly sessionStorage, but that is not an option it seems. I will probably have to write a script that removes it from local and rewrites it to sessionstorage. Not sure if all this is best practice security wise though..

EDIT: come to think of it, this only works because I am running it from tab to tab, likely that when just opening a link from an email this won't work.

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