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.
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');
}
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.