Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!